admin管理员组文章数量:1317579
I try to use Jasny fileupload to pass multiple files to php inside of a form, which on submit event should be uploaded via ajax posted datas. But I can't get it to work. I can not append jasny uploads to posted datas.
If there is a better workaround what would be better to implement instead jasny I would like to know about.
I init my upload fields as follows
jQuery('.fileupload').fileupload({});
I try to catch theme on submit
wizard.on("submit", function(wizard) {
jQuery.ajax({
//here When I serialize the form I do not get the files
});
});
I try to use Jasny fileupload to pass multiple files to php inside of a form, which on submit event should be uploaded via ajax posted datas. But I can't get it to work. I can not append jasny uploads to posted datas.
If there is a better workaround what would be better to implement instead jasny I would like to know about.
I init my upload fields as follows
jQuery('.fileupload').fileupload({});
I try to catch theme on submit
wizard.on("submit", function(wizard) {
jQuery.ajax({
//here When I serialize the form I do not get the files
});
});
Share
Improve this question
edited Mar 14, 2014 at 18:41
Agustin Lopez
1,3654 gold badges18 silver badges35 bronze badges
asked Dec 27, 2013 at 11:00
fefefefe
9,06530 gold badges111 silver badges191 bronze badges
3
- 2 It would be helpful if you set up a jsfiddle or similar showing more of your code. – Nico Commented Mar 11, 2014 at 21:04
- sorry I will try to refresh this issue. At that time I choose another workaround – fefe Commented Mar 13, 2014 at 20:51
- how does your form look like? Do you have proper enctype? – Gogol Commented Mar 14, 2014 at 10:48
3 Answers
Reset to default 7 +100Try with
var data = new FormData();
jQuery.each($('#file')[0].files, function(i, file) {
data.append('file-'+i, file);
});
So now you have a FormData object, ready to be sent along with the XMLHttpRequest.
$.ajax({
url: 'php/upload.php',
data: data,
cache: false,
contentType: false,
processData: false,
type: 'POST',
success: function(data){
alert(data);
}
});
Please look at jQuery File Upload (https://github./blueimp/jQuery-File-Upload), it's support multiple files uploading and have backend implemented for PHP.
Let's go
1st you need put the multiple at your input file
2sd
you will need use the canvas and sent one by one at an loop in your script
give one look at https://plugins.jquery./tag/canvas/
http://canvasquery./
本文标签: javascriptJasny multiple file upload with other form elementsStack Overflow
版权声明:本文标题:javascript - Jasny multiple file upload with other form elements - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742019827a2414439.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论