Hello community, I have the following problem with blueimp fileupload
. I want to upload a single image to the server. But when I select in the input type file several times and select different images I receive all those images as if it were stored in the input the list of images. In my input delete the attribute múltiple
and name="file"
did not work.
my jquery code is:
$('#photo_news').fileupload({
url: '/_uploader/gallery/upload',
type: 'POST',
multipart: true,
dataType: 'json',
autoUpload: false,
singleFileUploads: true,
maxNumberOfFiles : 1,
replaceFileInput: false,
add: function(e, data){
$("#form_news").submit(function(e){
e.preventDefault();
data.formData = $("#form_news").serializeArray();
data.submit();
});
},
done: function(e, data) {
if(data){
window.location.reload();
}
},
error: function(e, data){
console.log(data);
}
});