Home>Article>Backend Development> PHP MVC framework skymvc supports multiple file upload implementation methods

PHP MVC framework skymvc supports multiple file upload implementation methods

墨辰丷
墨辰丷 Original
2018-06-02 09:56:42 9957browse

This article mainly introduces the PHP mvc framework skymvc file upload implementation code in detail, which supports multiple file upload operations. Interested friends can refer to it

The specific content is as follows

1.Code upload.ctrl.php

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.Code upload.html

  {include file="head.html"}  {include file="header.html"} 

上传文件

上传结果

{include file="footer.html"}

3.PHP code

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("上传出错了"); } */

Summary: The above is the entire content of this article , I hope it can be helpful to everyone’s study.

Related recommendations:

phpDetailed reflection and example analysis

phpImplementing flush is invalid,phpmethod of real-time output under IIS7

Notes on using PHP flush function

The above is the detailed content of PHP MVC framework skymvc supports multiple file upload implementation methods. For more information, please follow other related articles on the PHP Chinese website!

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