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: </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: </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']) {
}