jQuery-File-Upload icon indicating copy to clipboard operation
jQuery-File-Upload copied to clipboard

Get the changed uploaded file name

Open domeri opened this issue 14 years ago • 5 comments

Hi! I get the uploaded filename from this script (from client side) :

$('#fileupload').fileupload({ done : function (e, data){ filess = data.files; filenam = filess[0].name; } });

This will give the name of the file that we drag to upload, but if this file exists in the upload folder it will be renamed to filename(1).filetype, filename(2).filetype etc.

How can we return this filename

(because users may upload different files with same name, so we cant overwrite them)

domeri avatar Aug 16 '12 14:08 domeri

So you want them to be overwritten?

kraigballa avatar Aug 19 '12 01:08 kraigballa

No. I just was saing that it would be better if the php file would return the name the file was saved in server. So there will not be neccesery to create sessions to keep the filename but just get it from ajax request when the file has finished uploading.

domeri avatar Aug 21 '12 09:08 domeri

and....

done: function (e, data) { $.each(data.files, function (index, file) { alert(data.result[0].name); });

a3093 avatar Aug 24 '12 19:08 a3093

Please read: https://github.com/blueimp/jQuery-File-Upload#support

blueimp avatar Sep 05 '12 10:09 blueimp

You can do this by this way:

Bind this event to $('#fileupload');

.bind('fileuploaddone', function (e, data) { $.each(data.result.files, function (index, file) { console.log(data.result.files[index].name); });

cpeeyush avatar May 25 '13 12:05 cpeeyush