diff --git a/files/css/files.css b/files/css/files.css index a886958f13..d45d93441d 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -157,4 +157,5 @@ table td.delete { background-image:url('../img/delete.png'); } #selectedActions{ float:right; display:none; -} \ No newline at end of file +} +#uploadsize-message{display:none} \ No newline at end of file diff --git a/files/js/files.js b/files/js/files.js index f1c00650d0..dc59dda57e 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -153,40 +153,55 @@ $(document).ready(function() { var uploadId=form.attr('data-upload-id'); var files=this.files; var target=form.children('iframe'); - target.load(function(){ - var response=jQuery.parseJSON(target.contents().find('body').text()); - //set mimetype and if needed filesize - if(response){ - for(var i=0;i0){ - var size=simpleFileSize(files[i].size); - }else{ - var size='Pending'; - } - FileList.addFile(files[i].name,size,uploadTime,true); + totalSize+=files[i].size; + } + if(totalSize>$('#max_upload').val()){ + $( "#uploadsize-message" ).dialog({ + modal: true, + buttons: { + Close: function() { + $( this ).dialog( "close" ); + } + } + }); + }else{ + target.load(function(){ + var response=jQuery.parseJSON(target.contents().find('body').text()); + //set mimetype and if needed filesize + if(response){ + for(var i=0;i0){ + var size=simpleFileSize(files[i].size); + }else{ + var size='Pending'; + } + FileList.addFile(files[i].name,size,uploadTime,true); + } + + //clone the upload form and hide the new one to allow users to start a new upload while the old one is still uploading + var clone=form.clone(); + uploadId++; + clone.attr('data-upload-id',uploadId); + clone.attr('target','file_upload_target_'+uploadId); + clone.children('iframe').attr('name','file_upload_target_'+uploadId) + clone.insertBefore(form); + form.hide(); } - - //clone the upload form and hide the new one to allow users to start a new upload while the old one is still uploading - var clone=form.clone(); - uploadId++; - clone.attr('data-upload-id',uploadId); - clone.attr('target','file_upload_target_'+uploadId); - clone.children('iframe').attr('name','file_upload_target_'+uploadId) - clone.insertBefore(form); - form.hide(); }); //add multiply file upload attribute to all browsers except konqueror (which crashes when it's used) diff --git a/files/templates/index.php b/files/templates/index.php index 18b805529a..b0d4f556f4 100644 --- a/files/templates/index.php +++ b/files/templates/index.php @@ -43,4 +43,10 @@ +
+

+ t( 'The files you are trying to upload exceed the maximum size for file uploads on this server.' ); ?> +

+
+