jQuery fileupload - get list of uploaded files

后端 未结 10 1862
天涯浪人
天涯浪人 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-15 00:05

    Well this is quite an old post, but this is something which worked very well for me so I thought to post it.

    1. Bind the event to FileUploader (I did it in main.js):

          $('#fileupload').bind('fileuploaddone', function (e, data) {
              FileUploadDone(e, data);
          });
      
    2. 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.

提交回复
热议问题