Closed rabat1313 closed 4 years ago
@rabat1313 there are 2 solutions that I would use:
1. Two inputs, one name, one php
<input type="file" name="files" id="files_1">
<input type="file" name="files" id="files_2">
var fileuploaderConfig = {
limit: 10,
upload: {
url: 'php/ajax.php'
}
};
$('#files_1').fileuploader(fileuploaderConfig);
$('#files_2').fileuploader($.extend({}, fileuploaderConfig, {
limit: 20
}));
<?php
$FileUploader = new FileUploader('files', array());
2. Two inputs, name over ajax
<input type="file" name="files" id="files_1">
<input type="file" name="files" id="files_2">
var fileuploaderConfig = {
limit: 10,
upload: {
url: 'php/ajax.php',
beforeSend: function(item, listEl, parentEl, newInputEl, inputEl) {
item.upload.data._input = inputEl.attr('name');
}
}
};
$('#files_1').fileuploader(fileuploaderConfig);
$('#files_2').fileuploader($.extend({}, fileuploaderConfig, {
limit: 20
}));
<?php
$inputName = isset($_POST['_input']) ? $_POST['_input'] : 'files';
$FileUploader = new FileUploader($inputName, array(
'required' => true
));
Is it possible to make dynamic AJAX upload URL (to PHP) which contains the name of input?