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
- $(document).on('submit',
'.newpost', function(e) {
-
e.preventDefault(); // prevent native submit
-
var id = e.target.getAttribute('data-thread-id');
-
var idAux = "id" +
Math.random().toString(16).slice(2)
-
$('#upload-path'+id).empty();
-
$("#reply_form"+id).toggleClass('post-active');
-
-
$(this).ajaxSubmit({
-
delegation: true,
-
resetForm: true,
-
clearForm: true,
-
success: function(response) {
-
$("#progress-bar"+idAux ).remove();
-
if (response['field-errors'] ||
response['errors'] || response['detail']) {
-
//alert("error ")
-
} else {
-
app.Board.success(response);
-
}
-
},
-
error: function(xhr, status, error){
-
//alert('Error occured');
-
-
},
-
-
-
url: $.api.url + 'post/?format=json',
-
data: $(this).serializeArray(),
-
type: 'POST',
-
complete: function(xhr, settings) {
-
$('.newpost').find("input[type='submit']").prop('disabled',false);
-
$("#overlay_loading").hide();
-
$("#overlay_loading img").hide();
-
-
},
-
beforeSend: function(xhr, settings) {
-
$(
-
'<div class="progress mb10" id="progress-bar'+idAux+'">\
-
<div class="bar"
id="bar'+idAux+'"></div >\
-
<div class="percent "
id="percent'+idAux+'">0%</div >\
-
</div>'
-
).appendTo("div[progress-id='"+id+"']");
-
-
app.Board.activatedPusub = false;
-
var percentVal = '0%';
-
$('#bar'+id).width(percentVal)
-
$('#percent'+id).html(percentVal);
-
-
},
-
uploadProgress: function(event, position, total,
percentComplete) {
-
var percentVal = percentComplete + '%';
-
$('#bar'+idAux).width(percentVal)
-
$('#percent'+idAux).html(percentVal);
-
},
-
-
})
-
});
thanks ....