Skip to content
Snippets Groups Projects
Commit 3d5c13a3 authored by Arthur Schiwon's avatar Arthur Schiwon
Browse files

don't create firefox hardlock

parent ef25b328
No related branches found
No related tags found
No related merge requests found
......@@ -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)));
?>
$(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() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment