Multiple File Upload Widgets on the same page - ma

2019-08-22 03:12发布

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

1条回答
神经病院院长
2楼-- · 2019-08-22 03:35

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">

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,
	});
});

查看更多
登录 后发表回答