From 5f1f928d0e1352c8654e4a791571f4154e41d8b5 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Mar 19 2015 10:48:15 +0000 Subject: Handle the situation where the upload fails because the file is too large or other --- diff --git a/progit/static/upload.js b/progit/static/upload.js index fe8b97d..4380c84 100644 --- a/progit/static/upload.js +++ b/progit/static/upload.js @@ -78,6 +78,26 @@ function doUpload(csrf_token, files) { 1000 /* 1 000ms = 2 s */ ); }, + error: function(data) { + $("#progress").hide(); + var text = data.responseText; + if ( !text || text === "" ) { + text = '

An error occured when uploading your file. Could it be ' + + 'that it exceeds the maximum limit allowed?

' + + '

Please contact an admin if this problem persist or is ' + + 'blocking you. Thanks!

'; + } + var _elt = $('
' + text + '
'); + _elt.dialog({ + height: 'auto', + width: '50%', + modal: true, + cache: false, + close: function() { + $(this).html(""); + }, + }); + } }); }