Avatar of ivanblue
ivanblue
Flag for United States of America asked on

Check if a file has been selected with BlueImp's JQuery File Upload

Hello, I'm using BlueImp's JQuery File Upload plugin (https://github.com/blueimp/jQuery-File-Upload) and although everything is working properly I don't know how to check if the input has a file. How can I do this?

This is my html:

<span class="btn fileinput-button">
    <i class="icon-camera"></i>
    <input id="filUserNewPostImageUpload" name="file" type="file" />
</span>

Open in new window


This is the jquery:

$("#filUserNewPostImageUpload").fileupload({
   url: "/userattachment/upload/",
   dataType: "json",
   start: function(e){
      $("#hidUserNewPostAttachment").val("");
   },
   done: function (e, data) {

      if(data.result.result == "success"){
         // This returns an empty string even when a file has been uploaded successfully
         console.log($("#filUserNewPostImageUpload").val());  
      }
   }
});

Open in new window


Thanks!
JavaScriptjQueryAJAX

Avatar of undefined
Last Comment
leakim971

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
leakim971

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck