title: JQuery file upload - "Error Empty file upload result" when adding title and description to database (php and mysql)
body: <p>I've been trying to get jQuery file upload to work with db-integration <a href="https://github.com/blueimp/jQuery-File-Upload" rel="nofollow">at this link</a></p>
  
  <p>I've followed (at least I think so...) all instructions on how to get the integration with MySql to work. The file upload correctly, but I still get two instances of "Error file upload result". This is even though the file actually upload to my server/directory.</p>
  
  <p>The snippet:</p>
  
  <pre><code>&lt;label class="title"&gt;
      &lt;span&gt;Title:&lt;/span&gt;&lt;br&gt;
      &lt;input name="title[]" class="form-control"&gt;
  &lt;/label&gt;
  
  &lt;label class="description"&gt;
    &lt;span&gt;Description:&lt;/span&gt;&lt;br&gt;
    &lt;input name="description[]" class="form-control"&gt;
  &lt;/label&gt;
  </code></pre>
  
  <p>is added in index.html after</p>
  
  <pre><code>&lt;!-- The template to display files available for upload --&gt;
  &lt;script id="template-upload" type="text/x-tmpl"&gt;    
  {% for (var i=0, file; file=o.files[i]; i++) { %}
  </code></pre>
  
  <p>This is basically the only code I've changed/added.</p>
  
  <p>I've done lots of debugging and figured out that for some reason, in jquery.fileupload-ui-js,</p>
  
  <pre><code>if (data.context) {
      data.context.each(function (index) {
      if (!$(data.context[index]).hasClass(that.options.uploadTemplateId)) { return true; }
           var file = files[index] ||
               {error: 'Empty file upload result'};
  </code></pre>
  
  <p>There has been many issues in this piece of code earlier (I read old bugs/forums/help threads) but the code is now a bit different, but I seem to get similar problems.</p>
  
  <p>The loop over file[index] seems to treat the title and decription wrong for some reason, it thinks there are 0-1-2 files instead of only one, and therefore try to reference 2 indexes which are not there... resulting in the two error messages.</p>
  
  <p>Why does the callback function create 3 fiels instead of 1 file with more parameters, or why is the index treating the variables and files? I can't seem to figure out what's going wrong :-(</p>
  
  <p>Does anyone have a MySql integration working with the latest code in the repository?</p>
  
  <p>OBS - Without the MySql integration, I don't get the errors. (i.e. if I remove the html snippet in the beginning).</p>
  
  <p>(I've added this to main.js also)</p>
  
  <pre><code>$('#fileupload').fileupload({
        url: 'server/php/'
     }).on('fileuploadsubmit', function (e, data) {
          data.formData = data.context.find(':input').serializeArray();
      });
  </code></pre>
  
  <p>and done all the other stuff in the documentation on how to integrate with a DB.</p>
  
  <p>None of the suggestions found on github seems to help (permissions, gd, filesize etc (and like I said, it works without the db-integration, but it's not the db that screems, it's before that). The problems suggestions from 4-5 months ago doesn't help either. I'm thinking no one has tried to build a new integration since the latest updates? (or I just screwed something up that I can't see)</p>
  
  <p>P.S. I've also tried to ask this at the help forum, but no one has even read it, and not sure if it's real bug or not, so not posting at such yet.
  <a href="https://groups.google.com/forum/#!topic/jquery-fileupload/QuTQHiOCcxk" rel="nofollow">https://groups.google.com/forum/#!topic/jquery-fileupload/QuTQHiOCcxk</a></p>