PHP MVC框架skymvc支持多文件上传

前端之家收集整理的这篇文章主要介绍了PHP MVC框架skymvc支持多文件上传前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1.代码upload.ctrl.PHP

PHP;"> public function construct(){
parent::
construct();
}

public function onDefault(){

$this->smarty->display("upload/default.html");
}

public function onUpload(){

$this->loadClass("upload");
//上传文件目录
$this->upload->uploaddir="attach/my/";
//允许上传文件大小
$this->upload->maxsize=4194304000;
//是否上传图片
$this->upload->upimg=true;
//设置允许上传文件类型
$this->upload->sysallowtype=array('gif','jpg','bmp','png','jpeg','txt','mpeg','avi','rm','rmvb','wmv','flv','mp3','wav','wma','swf','doc','pdf','zip','tar','svg');
$this->upload->allowtype=$this->upload->sysallowtype;
//根据Id存储
$this->upload->iddir=0;
$data=$this->upload->uploadfile("upimg");
//print_r($data);
echo json_encode($data);

}

}

?>

2.代码upload.html

{include file="head.html"}

{include file="header.html"}
<div class="main-body Box960">
<form method="post" action="/index.PHP?m=upload&a=upload" enctype="multipart/form-data">
<div class="row">
<div class="btn-upload">
<i class="iconfont icon-upload">
上传文件
<div class="btn-upload-file">

上传">

上传结果

{include file="footer.html"}

3.PHP代码

PHP;"> function skyUpload(upid,url,success,error,uploadProgress) { var vFD = new FormData(); var f= document.getElementById(upid).files; $("#"+upid+"loading").show(); for(var i=0;i}
}

/*
function uploadFinish(e){
var data=eval("("+e.target.responseText+")");
$("#uploading").hide()
if(data.error != '')
{
skyToast(data.msg);
}else
{
$("#imgShow").html("");
$("#imgurl").val(data.imgurl);
}
}

function uploadError(e) { // upload error
skyToast("上传出错了");
}
*/

以上就是本文的全部内容,希望对大家学习PHP程序设计有所帮助。

原文链接:https://www.f2er.com/php/19634.html

猜你在找的PHP相关文章