Closed rabat1313 closed 5 years ago
OK, I see where the problem is... There is a problem with using API twice on same page. Any idea how fix it? Maybe any way to make dynamic API name?
@rabat1313 are you using the following logic?
Inputs
<input type="file" name="files_1" id="file_1">
<input type="file" name="files_2" id="file_2">
.fileuploader()
var $file1 = $('#file_1').fileuploader({
enableApi: true
});
var $file2 = $('#file_2').fileuploader({ enableApi: true });
3. API
~~~js
var api1 = $.fileuploader.getInstance($file1);
var api2 = $.fileuploader.getInstance($file2);
@rabat1313 in PHP you also have 2 instances for 2 different uploaders, right?
$FileUplaoder1 = new FileUploader('files_1', array(...))
$FileUplaoder2 = new FileUploader('files_2', array(...))
No, I use same PHP files (your fileuplader class and upload/delete files) for both instances.
An instance of new FileUploader
is used for one <input type="file">
. So you need 2 instances for 2 different names.
Everything works! Thank you!
I have a problem with files upload to server when double use on same page. I use theme: "thumbnails", addMore: true and upload start: true. First uploader load images but doesn't upload to server's directory, second one is OK - everything works. I check consol's logs for onSuccess' results:
[...]
onSuccess: function(result, item) {
console.log(result);
var data = {};
[...]
and I get in console:
{"hasWarnings":false,"isSuccess":false,"warnings":[],"files":[]}
Second file uploader is fine but I have a problem with first one... Any idea?
My instances:
$('#file_1').fileuploader({
extensions: ['jpg', 'jpeg', 'png']
});
$('#file_2').fileuploader({
extensions: null
});