title: How to find out if an item was dropped
body: <p>I created a form that allows drag and drop for images. So what I've done is that when a user drops an image then the 
  <code>$("#fileuploader").on('drop', function(e)</code> grabs the filename and then uses the <code>$(this).trigger('got-dropped', [filename_list]);</code>
  to then pass on the filename to the <code>saveForm()</code>. The problem I'm having with my code is that if I do submit a form with an image
  then my form is submitted twice, one with the image and one without the image. I know that the problem I'm having is due to this</p>
  
  <pre><code>$('#fileuploader').on('got-dropped', function(event, files){
      saveForm(files);
  });
  
  files = '';
  saveForm(files);
  </code></pre>
  
  <p>but I'm not sure on how I should go about finding out if there was a file uploaded or not. If I remove</p>
  
  <pre><code>files = '';
  saveForm(files);
  </code></pre>
  
  <p>then I can't submit my form, because the <code>saveForm()</code> function only works if I've dropped an image, but if I keep the code then my
  form is submitted twice.</p>
  
  <p>Here is my full js code</p>
  
  <pre><code>$(document).ready(function()
  {
      var getUrl = "http://cms.test";
  
      $("#fileuploader").uploadFile({
          url: getUrl+"/admin/includes/upload.php",
          multiple: true,
          dragDrop: true,
          showPreview: true,
          previewWidth: "100px",
          showDelete: true,
          fileName:"myfile"
      });
  
      $("#fileuploader").on('drop', function(e){
          e.preventDefault();
  
          var files_list = e.originalEvent.dataTransfer.files;
  
          var filename_list = [];
          for(x = 0; x &lt; files_list.length; x++)
          {
              var filename = files_list[x].name;
              filename_list.push(filename);
          }
  
          $(this).trigger('got-dropped', [filename_list]);
      });
  
      $('#fileuploader').on('got-dropped', function(event, files){
          saveForm(files);
      });
  
      files = '';
      saveForm(files);
  });
  
  function saveForm(files_list)
  {
      var getUrl = "http://cms.test";
  
      $(".create_menu").click(function(){
          var menu_title = $('input#menu_title').val();
          var type = $("input[name='type']:checked").val();
          var main_menu_checkbox = $('input[name=main_menu]').is(':checked');
          var side_menu_checkbox = $('input[name=side_menu]').is(':checked');
  
          if(main_menu_checkbox == true)
          {
              var main_menu = 1;
          }else{
              var main_menu = 0;
          }
  
          if(side_menu_checkbox == true)
          {
              var side_menu = 1;
          }else{
              var side_menu = 0;
          }
  
          var files = files_list;
  
          var selectParentMenu = $('#selectParentMenu').val();
  
          var dataString = 'menu_title='+menu_title+'&amp;type='+type+'&amp;main_menu='+main_menu+'&amp;side_menu='+side_menu+'&amp;selectParentMenu='+selectParentMenu+'&amp;files='+files;
  
          $.ajax({
              type: 'post',
              url: getUrl+'/admin/menus.php?source=add_menu',
              data: dataString,
              success: function(){
                  // $("#message").html("&lt;h2&gt;It has been submitted&lt;/h2&gt;");
              }
          })
      });
  }
  </code></pre>