Home  >  Article  >  Backend Development  >  PHP MVC框架skymvc支持多文件上传,_PHP教程

PHP MVC框架skymvc支持多文件上传,_PHP教程

WBOY
WBOYOriginal
2016-07-12 08:50:51687browse

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

本文实例为大家分享了skymvc实现文件上传的具体代码,供大家参考,具体内容如下

1.代码upload.ctrl.php    

<?php
class uploadControl extends skymvc{
  
 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"}
上传文件

上传结果

{include file="footer.html"}

3.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");
   $("#imgurl").val(data.imgurl);
   }
}
  
function uploadError(e) { // upload error
  skyToast("上传出错了");
}
*/

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

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/1133072.htmlTechArticlePHP MVC框架skymvc支持多文件上传, 本文实例为大家分享了skymvc实现文件上传的具体代码,供大家参考,具体内容如下 1.代码upload.ctrl.php php...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn