Skip to content
Snippets Groups Projects
Commit d6bf5cd2 authored by Robin Appelman's avatar Robin Appelman
Browse files

show error when trying to upload to large files

parent e6e14719
Branches
No related tags found
No related merge requests found
...@@ -158,3 +158,4 @@ table td.delete { background-image:url('../img/delete.png'); } ...@@ -158,3 +158,4 @@ table td.delete { background-image:url('../img/delete.png'); }
float:right; float:right;
display:none; display:none;
} }
#uploadsize-message{display:none}
\ No newline at end of file
...@@ -153,6 +153,20 @@ $(document).ready(function() { ...@@ -153,6 +153,20 @@ $(document).ready(function() {
var uploadId=form.attr('data-upload-id'); var uploadId=form.attr('data-upload-id');
var files=this.files; var files=this.files;
var target=form.children('iframe'); var target=form.children('iframe');
var totalSize=0;
for(var i=0;i<files.length;i++){
totalSize+=files[i].size;
}
if(totalSize>$('#max_upload').val()){
$( "#uploadsize-message" ).dialog({
modal: true,
buttons: {
Close: function() {
$( this ).dialog( "close" );
}
}
});
}else{
target.load(function(){ target.load(function(){
var response=jQuery.parseJSON(target.contents().find('body').text()); var response=jQuery.parseJSON(target.contents().find('body').text());
//set mimetype and if needed filesize //set mimetype and if needed filesize
...@@ -187,6 +201,7 @@ $(document).ready(function() { ...@@ -187,6 +201,7 @@ $(document).ready(function() {
clone.children('iframe').attr('name','file_upload_target_'+uploadId) clone.children('iframe').attr('name','file_upload_target_'+uploadId)
clone.insertBefore(form); clone.insertBefore(form);
form.hide(); form.hide();
}
}); });
//add multiply file upload attribute to all browsers except konqueror (which crashes when it's used) //add multiply file upload attribute to all browsers except konqueror (which crashes when it's used)
......
...@@ -43,4 +43,10 @@ ...@@ -43,4 +43,10 @@
</tbody> </tbody>
</table> </table>
<div id="uploadsize-message" title="Upload to large">
<p>
<?php echo $l->t( 'The files you are trying to upload exceed the maximum size for file uploads on this server.' ); ?>
</p>
</div>
<span id="file_menu"/> <span id="file_menu"/>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment