if a deleted file is uploaded, finish the delete first

otherwise the upload will fail because the file still exists on the server, the old file will be deleted and neither the old or new file will be left
remotes/origin/stable4
Robin Appelman 13 years ago
parent 11cb45bd43
commit 66f4f06dd9
  1. 7
      files/js/files.js

@ -166,6 +166,7 @@ $(document).ready(function() {
$('.file_upload_start').live('change',function(){
var form=$(this).closest('form');
var that=this;
var uploadId=form.attr('data-upload-id');
var files=this.files;
var target=form.children('iframe');
@ -173,6 +174,12 @@ $(document).ready(function() {
if(files){
for(var i=0;i<files.length;i++){
totalSize+=files[i].size;
if(FileList.deleteFiles && FileList.deleteFiles.indexOf(files[i].name)!=-1){//finish delete if we are uploading a deleted file
FileList.finishDelete(function(){
$(that).change();
});
return;
}
}
}
if(totalSize>$('#max_upload').val()){

Loading…
Cancel
Save