--- loncom/publisher/lonupload.pm 2001/11/29 21:51:40 1.8 +++ loncom/publisher/lonupload.pm 2001/12/04 18:13:06 1.9 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to upload files into construction space # -# $Id: lonupload.pm,v 1.8 2001/11/29 21:51:40 matthew Exp $ +# $Id: lonupload.pm,v 1.9 2001/12/04 18:13:06 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -90,7 +90,7 @@ sub phaseone { '
'. ''); - # Check for bad extension + # Check for bad extension and warn user if ($fn=~/\.(\w+)$/ && (&Apache::lonnet::fileembstyle($1) eq 'hdn')) { $r->print( @@ -99,7 +99,15 @@ sub phaseone { '", is reserved internally by LON-CAPA.
'. 'Please change the extension.'. ''); - } + } elsif($fn=~/\.(\w+)$/ && + !defined(&Apache::lonnet::fileembstyle($1))) { + $r->print( + ''. + 'The extension on this file, "'.$1. + '", is not recognized by LON-CAPA.
'. + 'Please change the extension.'. + '
'); + } } else { $r->print('Illegal filename.'); } @@ -127,7 +135,7 @@ sub phasetwo { } else { my $source=$r->dir_config('lonDaemons'). '/tmp/'.$datatoken.'.tmp'; - # Check for bad extension + # Check for bad extension and disallow upload if ($fn=~/\.(\w+)$/ && (&Apache::lonnet::fileembstyle($1) eq 'hdn')) { $r->print( @@ -135,6 +143,13 @@ sub phasetwo { ''. 'The extension on this file is reserved internally by LON-CAPA.'. ''); + } elsif ($fn=~/\.(\w+)$/ && + !defined(&Apache::lonnet::fileembstyle($1))) { + $r->print( + 'File '.$fn.' could not be copied.
'. + ''. + 'The extension on this file is not recognized by LON-CAPA.'. + ''); } elsif (copy($source,$target)) { $r->print('File copied.'); $r->print('