show error when trying to upload to large files

This commit is contained in:
Robin Appelman 2011-07-22 15:48:30 +02:00
parent e6e14719c9
commit d6bf5cd251
3 changed files with 55 additions and 33 deletions

View File

@ -158,3 +158,4 @@ table td.delete { background-image:url('../img/delete.png'); }
float:right;
display:none;
}
#uploadsize-message{display:none}

View File

@ -153,6 +153,20 @@ $(document).ready(function() {
var uploadId=form.attr('data-upload-id');
var files=this.files;
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(){
var response=jQuery.parseJSON(target.contents().find('body').text());
//set mimetype and if needed filesize
@ -187,6 +201,7 @@ $(document).ready(function() {
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)

View File

@ -43,4 +43,10 @@
</tbody>
</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"/>