因为用户上传的一些文件很大,我希望上传在模式窗口内进行,以便他们在上传过程中自由导航。我无法将模态窗口集成到 jquery 中。有人能帮忙吗。谢谢
function upload() {
var fileInput = $('#file')[0];
var data = new FormData();
for(var i = 0; i < fileInput.files.length; ++i){
data.append('file[]',fileInput.files[i]);
}
$.ajax({
type:'POST',
method:'POST',/* for newest version of jQuery */
url:'upload.php',
headers:{'Cache-Control':'no-cache'},
data:data,
contentType:false,
processData:false,
success: function(response){
var return_data = response;
alert(return_data);
if(return_data !== 'success') {
failed();
}
else if(return_data == 'success') {
success();
}
}
});
}
<boby>
<form id="form" method = "POST" enctype="multipart/form-data">
<input type = "file" id = "file" multiple />
</form>
</body>