--- loncom/publisher/lonupload.pm 2001/12/17 00:57:59 1.10 +++ loncom/publisher/lonupload.pm 2002/08/08 02:30:39 1.12 @@ -1,7 +1,8 @@ + # The LearningOnline Network with CAPA # Handler to upload files into construction space # -# $Id: lonupload.pm,v 1.10 2001/12/17 00:57:59 harris41 Exp $ +# $Id: lonupload.pm,v 1.12 2002/08/08 02:30:39 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -55,6 +56,24 @@ use File::Copy; use Apache::Constants qw(:common :http :methods); use Apache::loncacc; use Apache::loncommon(); +use Apache::Log(); + +my $DEBUG=0; + +sub Debug { + + # Marshall the parameters. + + my $r = shift; + my $log = $r->log; + my $message = shift; + + # Put out the indicated message butonly if DEBUG is false. + + if ($DEBUG) { + $log->debug($message); + } +} sub upfile_store { my $r=shift; @@ -85,7 +104,8 @@ sub phaseone { $fn.=$ENV{'form.upfile.filename'}; $fn=~s/^\///; $fn=~s/(\/)+/\//g; - + $fn=~s/%20/ /g; + &Debug($r, "Filename for upload: $fn"); if (($fn) && ($fn!~/\/$/)) { $r->print( '
'. @@ -156,6 +176,7 @@ sub phasetwo { 'The extension on this file is not recognized by LON-CAPA.'. ''); } elsif (copy($source,$target)) { + chmod(0660, $target); # Set permissions to rw-rw---. $r->print('File copied.'); $r->print('

View file');