同一页面上的多个文件上传小部件-main.js [英] Multiple File Upload Widgets on the same page - main.js
本文介绍了同一页面上的多个文件上传小部件-main.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将blueimp上传文件的main.js更改为在同一页面上具有多个文件上传小部件.我将ID更改为类的形式.我也在main.js中进行了更改:
I am trying to change main.js for blueimp upload files to have multiple file upload widgets on the same page. I changed id to class for form. I also changed in main.js:
$('.fileupload').each(function () {
$(this).fileupload({
dropZone: $(this)
url: 'server/php/'
});
});
$('.fileupload').each(function () {
$(this).fileupload({
dropZone: $(this)
'option',
'redirect',
window.location.href.replace(
/\/[^\/]*$/,
'/cors/result.html?%s'
)
});
});
仍然无法正常工作.任何的想法?非常感谢.卡特里娜飓风
still not working. Any idea? Thanks a lot. katarina
推荐答案
,应将action参数赋予表单.
on the page where you create the two instance of upload widget you should give the action parameter to your forms.
<form class="fileupload" action="server/php/" method="POST" enctype="multipart/form-data">
<form class="fileupload" action="server/php2/" method="POST" enctype="multipart/form-data">
在main.js中,您应该使用表单的此属性来调用不同的上传处理程序:
In the main.js you should use this attribute of your form to call the different upload handlers:
$('.fileupload').each(function () {
var action = $(this).attr('action');
$(this).fileupload({
dropZone: $(this),
url: action,
});
});
这篇关于同一页面上的多个文件上传小部件-main.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文