show error when trying to upload to large files
This commit is contained in:
parent
e6e14719c9
commit
d6bf5cd251
|
@ -157,4 +157,5 @@ table td.delete { background-image:url('../img/delete.png'); }
|
||||||
#selectedActions{
|
#selectedActions{
|
||||||
float:right;
|
float:right;
|
||||||
display:none;
|
display:none;
|
||||||
}
|
}
|
||||||
|
#uploadsize-message{display:none}
|
|
@ -153,40 +153,55 @@ $(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');
|
||||||
target.load(function(){
|
var totalSize=0;
|
||||||
var response=jQuery.parseJSON(target.contents().find('body').text());
|
|
||||||
//set mimetype and if needed filesize
|
|
||||||
if(response){
|
|
||||||
for(var i=0;i<response.length;i++){
|
|
||||||
var file=response[i];
|
|
||||||
$('tr[data-file="'+file.name+'"]').attr('data-mime',file.mime);
|
|
||||||
if(size=='Pending'){
|
|
||||||
$('tr[data-file='+file.name+'] td.filesize').text(file.size);
|
|
||||||
}
|
|
||||||
FileList.loadingDone(file.name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
form.submit();
|
|
||||||
var date=new Date();
|
|
||||||
var uploadTime=formatDate(date);
|
|
||||||
for(var i=0;i<files.length;i++){
|
for(var i=0;i<files.length;i++){
|
||||||
if(files[i].size>0){
|
totalSize+=files[i].size;
|
||||||
var size=simpleFileSize(files[i].size);
|
}
|
||||||
}else{
|
if(totalSize>$('#max_upload').val()){
|
||||||
var size='Pending';
|
$( "#uploadsize-message" ).dialog({
|
||||||
}
|
modal: true,
|
||||||
FileList.addFile(files[i].name,size,uploadTime,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;i<response.length;i++){
|
||||||
|
var file=response[i];
|
||||||
|
$('tr[data-file="'+file.name+'"]').attr('data-mime',file.mime);
|
||||||
|
if(size=='Pending'){
|
||||||
|
$('tr[data-file='+file.name+'] td.filesize').text(file.size);
|
||||||
|
}
|
||||||
|
FileList.loadingDone(file.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
form.submit();
|
||||||
|
var date=new Date();
|
||||||
|
var uploadTime=formatDate(date);
|
||||||
|
for(var i=0;i<files.length;i++){
|
||||||
|
if(files[i].size>0){
|
||||||
|
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)
|
//add multiply file upload attribute to all browsers except konqueror (which crashes when it's used)
|
||||||
|
|
|
@ -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"/>
|
||||||
|
|
Loading…
Reference in New Issue