ajaxForm repeat attached file

ajaxForm repeat attached file

hi everybody i have a problem with the plugin ajaxForm i try to upload many times but when the first file is uploading i upload other file parallely but the first upload has file and the second file does not file when the uploads have finished the file attached at the first uploading is repeated at the second uploading but at the second i dont attache any file

what is the problem?


this is my code 

  1. $(document).on('submit', '.newpost', function(e) {
  2. e.preventDefault(); // prevent native submit
  3. var id = e.target.getAttribute('data-thread-id');
  4. var idAux = "id" + Math.random().toString(16).slice(2)
  5. $('#upload-path'+id).empty();
  6. $("#reply_form"+id).toggleClass('post-active');
  7. $(this).ajaxSubmit({
  8.   delegation: true,
  9.   resetForm: true,
  10.   clearForm: true,
  11.   success: function(response) {
  12.     $("#progress-bar"+idAux ).remove();
  13. if (response['field-errors'] || response['errors'] || response['detail']) {
  14.   //alert("error ")
  15. } else {  
  16.    app.Board.success(response);           
  17. }
  18.   },
  19.   error: function(xhr, status, error){
  20.   //alert('Error occured');
  21.    
  22. }, 
  23.   
  24.   url: $.api.url + 'post/?format=json',  
  25.   data: $(this).serializeArray(), 
  26.   type:  'POST', 
  27.   complete: function(xhr, settings) {
  28.              $('.newpost').find("input[type='submit']").prop('disabled',false); 
  29.              $("#overlay_loading").hide(); 
  30.  $("#overlay_loading img").hide(); 
  31.           },
  32.   beforeSend: function(xhr, settings) {  
  33. $(
  34. '<div class="progress mb10" id="progress-bar'+idAux+'">\
  35.   <div class="bar" id="bar'+idAux+'"></div >\
  36.   <div class="percent " id="percent'+idAux+'">0%</div >\
  37. </div>'
  38. ).appendTo("div[progress-id='"+id+"']");         
  39.  
  40. app.Board.activatedPusub = false;  
  41. var percentVal = '0%';
  42. $('#bar'+id).width(percentVal)
  43. $('#percent'+id).html(percentVal);
  44. },
  45.     uploadProgress: function(event, position, total, percentComplete) {
  46. var percentVal = percentComplete + '%';
  47. $('#bar'+idAux).width(percentVal)
  48. $('#percent'+idAux).html(percentVal);
  49.     },
  50. })
  51. });

thanks ....