Php mvc Framework skymvc supports Multifile upload,
This article provides examples to share with you the specific code for implementing File Upload using skymvc for your reference. The specific content is as follows:
1. Code upload. ctrl. php
<? Phpclass uploadControl extends skymvc {public function _ construct () {parent ::__ construct ();} public function onDefault () {$ this-> smarty-> display ("upload/default.html");} public function onUpload () {$ this-> loadClass ("upload "); // the uploaded file directory $ this-> upload-> uploaddir = "attach/my/"; // the file size that can be uploaded $ this-> upload-> maxsize = 4194304000; // whether to upload an image $ this-> upload-> upimg = true; // you can specify the file type that can be uploaded. $ this-> upload-> sysallowtyp E = array ('gif', 'jpg ', 'bmp', 'png ', 'jpeg', 'txt ', 'mpeg', 'av', 'rm ', 'rmvb ', 'wmv', 'flv', 'mp3', 'wav ', 'wm', 'swf', 'Doc', 'pdf ', 'zip ', 'tar ', 'svg'); $ this-> upload-> allowtype = $ this-> upload-> sysallowtype; // store $ this-> upload-> iddir = 0 by Id; $ data = $ this-> upload-> uploadfile ("upimg "); // print_r ($ data); echo json_encode ($ data) ;}}?>
2.code upload.html
<! Doctype 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 <f. length; I ++) {vFD. append ('upimg ', document. getElementById (upid ). files [I]); var oXHR = new XMLHttpRequest (); oXHR. addEventListener ('load', success, false); oXHR. addEventListener ('error', error, false); if (uploadProgress! = Undefined) {oXHR. upload. addEventListener ("progress", uploadProgress, false);} oXHR. open ('post', url); oXHR. send (vFD) ;}}/* function uploadFinish (e) {var data = eval ("+e.tar get. responseText + ")"); $ ("# uploading "). hide () if (data. error! = '') {SkyToast (data. msg);} else {$ ("# imgShow" cmd.html ("
The above is all the content of this article. I hope it will help you learn php programming.