--- loncom/lonnet/perl/lonnet.pm 2006/01/12 21:12:55 1.700 +++ loncom/lonnet/perl/lonnet.pm 2006/01/18 21:15:41 1.701 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.700 2006/01/12 21:12:55 albertel Exp $ +# $Id: lonnet.pm,v 1.701 2006/01/18 21:15:41 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1358,8 +1358,16 @@ sub finishuserfileupload { } # Save the file { - open(FH,'>'.$filepath.'/'.$file); - print FH $env{'form.'.$formname}; + if (!open(FH,'>'.$filepath.'/'.$file)) { + &logthis('Failed to create '.$filepath.'/'.$file); + print STDERR ('Failed to create '.$filepath.'/'.$file."\n"); + return '/adm/notfound.html'; + } + if (!print FH ($env{'form.'.$formname})) { + &logthis('Failed to write to '.$filepath.'/'.$file); + print STDERR ('Failed to write to '.$filepath.'/'.$file."\n"); + return '/adm/notfound.html'; + } close(FH); } if ($parser eq 'parse') {