通过文件上传提交AJAX表单

时间:2021-02-12 20:30:38

Hey guys. I am trying to ajax submit a form that contains file upload area. As i found out JS cannot handle file uploads therefore I am using this plugin -> http://jquery.malsup.com/form/#ajaxForm

嘿,伙计们。我正在尝试ajax提交一个包含文件上传区域的表单。我发现JS无法处理文件上传,所以我使用了这个插件——> http://jquery.malsup.com/form/#ajaxForm

However, after submitting the form, I am not getting anything in $_FILES. Does anyone know what is the reason and how I can fix this?

但是,在提交表单之后,我不会从$_FILES中获得任何内容。有人知道是什么原因吗?我该怎么解决?

My input field is <input type="file" name="logo" id="logo" /> and yes the form is multipart data.

我输入的字段是,是的,表单是多部分数据。

Thanks.

谢谢。

2 个解决方案

#1


4  

Take a look at http://www.ajaxf1.com/tutorial/ajax-file-upload-tutorial.html

请看http://www.ajaxf1.com/tutorial/ajax-file-upload-tutorial.html

#2


1  

use this plugin it uses XHR for uploading multiple files with progress-bar in FF3.6+, Safari4+, Chrome and falls back to hidden iframe based upload in other browsers, providing good user experience everywhere. check this: http://valums.com/ajax-upload/

使用这个插件,它使用XHR在FF3.6+, Safari4+, Chrome上上传多个文件,并在其他浏览器上返回隐藏的iframe,提供良好的用户体验。检查:http://valums.com/ajax-upload/

#1


4  

Take a look at http://www.ajaxf1.com/tutorial/ajax-file-upload-tutorial.html

请看http://www.ajaxf1.com/tutorial/ajax-file-upload-tutorial.html

#2


1  

use this plugin it uses XHR for uploading multiple files with progress-bar in FF3.6+, Safari4+, Chrome and falls back to hidden iframe based upload in other browsers, providing good user experience everywhere. check this: http://valums.com/ajax-upload/

使用这个插件,它使用XHR在FF3.6+, Safari4+, Chrome上上传多个文件,并在其他浏览器上返回隐藏的iframe,提供良好的用户体验。检查:http://valums.com/ajax-upload/