Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/228.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Ajax上传错误_Php_Jquery_Ajax_Upload - Fatal编程技术网

Php Ajax上传错误

Php Ajax上传错误,php,jquery,ajax,upload,Php,Jquery,Ajax,Upload,此文件索引 <form name="classupload" method="post" enctype="multipart/form-data" action=""> <h3>Select pictures:&nbsp;</h3><br /> <input type="file" name="Filedata[]" style="margin-top:2px;"/><br />

此文件索引

 <form name="classupload" method="post"  enctype="multipart/form-data" action="">
      <h3>Select pictures:&nbsp;</h3><br />
      <input type="file" name="Filedata[]" style="margin-top:2px;"/><br />
      <input type="file" name="Filedata[]" style="margin-top:2px;"/><br />

      <input type="file" name="Filedata[]" style="margin-top:2px;"/><br />
      <input type="file" name="Filedata[]" style="margin-top:2px;"/><br />
      <input type="file" name="Filedata[]" style="margin-top:2px;"/><br />
       <div id="viac"></div>
         <div style="margin-top:4px;"><a onclick="multiupload();">More</a><br /></div>
        <input type="submit" value="Upload" id="classupload"/>
      </form>
请帮我写文件upload.php显示文件
因为没有上传文件,我什么也得不到,请帮助?

您不能通过AJAX直接上传文件。您需要一个使用隐藏Iframe或使用HTML5功能的插件。

但其他插件使用FlashPlayer替代Flash是个坏主意。
jQuery(document).ready(function() { 
$("#classupload").click(function() {
        var xleng=document.classupload.elements['Filedata[]'].length;
        dv = document.createElement("div");
        for (var i = 0; i < xleng ; i++)
        {
            img=document.classupload.elements['Filedata[]'][i].value;
            if(img.toString().length > 1){
                $.ajax({
                    type: "POST",
                    url: "upload.php",
                    data: img,
                    success: function(data_response) {
                        dv.innerHTML = i + ' - ' + data_response;
                    }
                });
            }
        }
        responseStatus("Done!");
        document.getElementById("result").appendChild(dv);

        return false; // avoid to execute the actual submit of the form.


    })

}); 
    if ($_REQUEST['Filedata']) {

}