php jquery 多文件上传 演示 XML/HTML Code Upload <li class="alt"> <li>$(document).ready(function() <li class="alt">{ <li> <li class="alt">var settings = { <li> url: "upload.php", <li class="alt"> method: "POST", <li> allowedTypes:"jpg,png,gif,doc,pdf,zip", <li class="alt"> fileName: "myfile", <li> multiple: true, <li class="alt"> onSuccess:function(files,data,xhr) <li> { <li class="alt"> $("#status").html("<font color='green'>Upload is success"); <li> <li class="alt"> }, <li> onError: function(files,status,errMsg) <li class="alt"> { <li> $("#status").html("<font color='red'>Upload is Failed"); <li class="alt"> } <li>} <li class="alt">$("#mulitplefileuploader").uploadFile(settings); <li> <li class="alt">}); <li> upload.phpPHP Code //If directory doesnot exists create it. $output_dir = "../upload"; if(isset($_FILES["myfile"])) { $ret = array(); $error =$_FILES["myfile"]["error"]; { if(!is_array($_FILES["myfile"]['name'])) //single file { $fileName = $_FILES["myfile"]["name"]; move_uploaded_file($_FILES["myfile"]["tmp_name"],$output_dir. $_FILES["myfile"]["name"]); //echo " Error: ".$_FILES["myfile"]["error"]; $ret[$fileName]= $output_dir.$fileName; } else { $fileCount = count($_FILES["myfile"]['name']); for($i=0; $i { $fileName = $_FILES["myfile"]["name"][$i]; $ret[$fileName]= $output_dir.$fileName; move_uploaded_file($_FILES["myfile"]["tmp_name"][$i],$output_dir.$fileName ); } } } echo json_encode($ret); } ?> 原文地址:http://www.freejs.net/article_biaodan_116.html http://www.bkjia.com/PHPjc/621610.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/621610.htmlTechArticlephp jquery 多文件上传 演示 XML/HTML Code Upload script $(document).ready(function() { var settings = { url: "upload.php", method: "POST", allowedTypes:"jpg,png,gif,doc,pdf,z...