I\'m using the very good jquery plugin blueimp / jQuery-File-Upload
$(\'#fileupload\').fileupload({
autoUpload: true
, filesContainer: \'#attachments_prese
Well this is quite an old post, but this is something which worked very well for me so I thought to post it.
Bind the event to FileUploader (I did it in main.js):
$('#fileupload').bind('fileuploaddone', function (e, data) {
FileUploadDone(e, data);
});
In your html file, use the following code to get the file name:
function FileUploadDone(e, data) {
for (x in data._response.result.files){
if (data._response.result.files[x].error == "")
alert(data._response.result.files[x].name);
else
alert(data._response.result.files[x].error);
}}
You should watch the data object in firebug. This object encapsulates most of the information.
If, you'r using the basic-plugin asmentioned in the documentations you need to pass the data to the function in the done attribute. change this:
stop: function (e) {
to this:
done: function (e, data) {
I don't know about the stop if you get it from one of the documentations pages then I think the same applied here you can't work with data if its not available.
Hope this help
to get file list on upload finished:
$('#fileupload').bind('fileuploadfinished', function (e, data) {
console.log(data.originalFiles);
});
you can also try this
$('#fileupload').bind('fileuploadcompleted', function (e, data) {
var filess= data.result.files[0];
var filenam = filess.name;
alert(filenam);
});