title: Individual progress in jQuery file upload
body: <p>I've been recommended to use jQuery file upload by blueimp.</p>
  
  <p>But I fail to update the individual file progress. I understand how the combined progress works (as documented) </p>
  
  <pre><code>progressall: function (e, data) 
          {
              var progress = parseInt(data.loaded / data.total * 100, 10);
              $('#progress .bar').css('width', progress + '%');
              console.log(progress);
          }
  </code></pre>
  
  <p>How to do the same thing for every single upload? How do I retrieve the DOM element (progressbar) linked to this particular upload? I was thinking about creating an id by filename and file size, but as users could upload the same file twice (to different destinations) this doesn't work.</p>
  
  <p>This is my implementation at the moment:</p>
  
  <pre><code>$('#fileupload').fileupload(
      {
          dataType: 'json',
          done: function (e, data) 
          {
              $.each(data.result.files, function (index, file) 
              {  
                  //$('&lt;p/&gt;').text(file.name).appendTo(document.body); 
                  //console.log('done with '+file.name);
              });
          },
          progressall: function (e, data) 
          {
              var progress = parseInt(data.loaded / data.total * 100, 10);
              //$('#progress .bar').css('width', progress + '%');
              //console.log(progress);
          }
      }).on('fileuploadadd', function (e, data) 
      {
          $.each(data.files, function (index, file) 
          {
  
              var node = $('&lt;div class="progressBox"&gt;&lt;/div&gt;');
              node.append('&lt;div class="progressBoxBack"&gt;&lt;/div&gt;');
              node.append('&lt;p&gt;&lt;span class="progress-filename"&gt;'+file.name+' ('+index+')&lt;/span&gt;&lt;br /&gt;&lt;span class="progress-info"&gt;0%  0 ko/s  0 sec left&lt;/span&gt;&lt;/p&gt;');
              node.append('&lt;div class="progressBar"&gt;&lt;div style="width:23%;"&gt;&lt;/div&gt;&lt;/div&gt;');
  
              node.appendTo($('#progressContainer'));
          });
      });
  </code></pre>
  
  <p>Can anybody tell me how or point me to documentation I haven't been able to find?</p>
  
  <h2>Solution</h2>
  
  <p><hr>
  To identify the upload, you can add additional parameters to the file object when added. the file object stays the same in the progress event (But not in the done method)
  So on fileuploadadd:</p>
  
  <pre><code>.on('fileuploadadd', function (e, data) 
      {
          $.each(data.files, function (index, file) 
          {
              file.uploadID = 'someidentification' ;
          });
      });
  </code></pre>
  
  <p>then when you handle progress:</p>
  
  <pre><code>progress: function (e, data) {
                var progress = parseInt(data.loaded / data.total * 100, 10);
  
                console.log(data.files[0].uploadID); // returns 'someidentification'
  
          }
  </code></pre>