--- loncom/interface/loncommon.pm 2010/10/27 01:04:10 1.984 +++ loncom/interface/loncommon.pm 2010/10/29 20:41:43 1.985 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.984 2010/10/27 01:04:10 raeburn Exp $ +# $Id: loncommon.pm,v 1.985 2010/10/29 20:41:43 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -8560,7 +8560,17 @@ sub check_for_existing { sub check_for_upload { my ($path,$fname,$group,$element,$portfolio_root,$port_path, $disk_quota,$current_disk_usage,$uname,$udom) = @_; - my $filesize = (length($env{'form.'.$element})) / 1000; #express in k (1024?) + my $filesize = length($env{'form.'.$element}); + if (!$filesize) { + my $msg = ''. + &mt('Unable to upload [_1]. (size = [_2] bytes)', + ''.$fname.'', + $filesize).'
'. + &mt('Either the file you uploaded was empty, or your web browser was unable to read its contents.').'
'; + '
'; + return ('zero_bytes',$msg); + } + $filesize = $filesize/1000; #express in k (1024?) my $getpropath = 1; my @dir_list = &Apache::lonnet::dirlist($portfolio_root.$path,$udom,$uname, $getpropath);