jQuery fileupload - get list of uploaded files

后端 未结 10 1872
天涯浪人
天涯浪人 2020-12-14 23:49

I\'m using the very good jquery plugin blueimp / jQuery-File-Upload

$(\'#fileupload\').fileupload({
  autoUpload: true
, filesContainer: \'#attachments_prese         


        
10条回答
  •  旧巷少年郎
    2020-12-14 23:50

    I had the same problem and after a few hours and tens of file uploads, I think I have the answer you need:

    done: function (e, data) {
        response = data.response();
        parsedresponse = $.parseJSON(response.result);
        console.log(parsedresponse.files);
    }
    

    As you can see, you will find the uploaded files name at parsedresponse.files[i].url (i is the 0-based index of the uploaded files).

    Ok... its the uploaded file's URL, but you'll be able to extract the final file name ...

    Hope it helps. (this is nowhere in the documentation, I managed to get to this solution by checking the Firebug console outputs)

提交回复
热议问题