diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2011-04-19 09:13:50 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2011-04-19 09:13:50 +0200 |
commit | 3d5c13a3e16bedc7e8ce062c82e4ddb3b42d2318 (patch) | |
tree | cc4c44e1fbb3bd37256ec11bcf99e9fec1fd87af | |
parent | ef25b32856bb02f947297aaab03ba5265b3e9292 (diff) | |
download | nextcloud-server-3d5c13a3e16bedc7e8ce062c82e4ddb3b42d2318.tar.gz nextcloud-server-3d5c13a3e16bedc7e8ce062c82e4ddb3b42d2318.zip |
don't create firefox hardlock
-rw-r--r-- | files/ajax/upload.php | 2 | ||||
-rw-r--r-- | files/js/files.js | 10 |
2 files changed, 9 insertions, 3 deletions
diff --git a/files/ajax/upload.php b/files/ajax/upload.php index 194d84f4be2..0939ad0d097 100644 --- a/files/ajax/upload.php +++ b/files/ajax/upload.php @@ -28,6 +28,6 @@ if(strpos($dir,'..') === false){ $error = $_FILES['file']['error']; -echo json_encode(array( 'status' => 'error', 'data' => array('error' => $error))); +echo json_encode(array( 'status' => 'error', 'data' => array('error' => $error, "file" => $fileName))); ?> diff --git a/files/js/files.js b/files/js/files.js index 40857fb03d6..bfb68317b02 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -1,6 +1,7 @@ $(document).ready(function() { $('#file_action_panel').attr('activeAction', false); $('#file_upload_start').attr('mode', 'menu'); + $('#file_upload_form').attr('uploading', false); // Sets browser table behaviour : $('.browser tr').hover( @@ -73,6 +74,7 @@ $(document).ready(function() { $('#file_upload_start').click(function() { if($('#file_upload_start').attr('mode') == 'menu') { + $('#file_upload_form')[0].reset(); $('#fileSelector').change(function() { //Chromium prepends C:\fakepath.... bspos = $('#fileSelector').val().lastIndexOf('\\')+1; @@ -90,6 +92,7 @@ $(document).ready(function() { } } else if($('#file_upload_start').attr('mode') == 'action') { $('#file_upload_cancel').slideUp(250); + $('#file_upload_form').attr('uploading', true); $('#file_upload_target').load(uploadFinished); } }); @@ -184,8 +187,11 @@ $(document).ready(function() { function uploadFinished() { result = $('#file_upload_target').contents().text(); result = eval("(" + result + ");"); + $('#file_upload_target').load(function(){}); if(result.status == "error") { - alert('An error occcured, upload failed.\nError code: ' + result.data.error); + if($('#file_upload_form').attr('uploading') == true) { + alert('An error occcured, upload failed.\nError code: ' + result.data.error + '\nFilename: ' + result.data.file); + } } else { dir = $('#dir').val(); $.ajax({ @@ -198,10 +204,10 @@ function uploadFinished() { // $('p.actions a.upload:first').show(); $('#file_upload_start').val('Upload ' + $('.max_human_file_size:first').val()); $('#file_upload_start').attr('mode', 'menu'); -// $('#fileSelector').replaceWith('<input type="file" name="file" id="fileSelector">'); } }); } + $('#file_upload_form').attr('uploading', false); } function resetFileActionPanel() { |