--- loncom/publisher/lonupload.pm 2011/10/23 23:46:07 1.54 +++ loncom/publisher/lonupload.pm 2011/11/02 23:19:22 1.58 @@ -1,8 +1,7 @@ - # The LearningOnline Network with CAPA # Handler to upload files into construction space # -# $Id: lonupload.pm,v 1.54 2011/10/23 23:46:07 www Exp $ +# $Id: lonupload.pm,v 1.58 2011/11/02 23:19:22 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -163,7 +162,7 @@ sub upfile_store { } sub phaseone { - my ($r,$fn,$uname,$udom,$mode)=@_; + my ($r,$fn,$mode)=@_; my $action = '/adm/upload'; if ($mode eq 'testbank') { $action = '/adm/testbank'; @@ -179,12 +178,9 @@ sub phaseone { return; } - $fn=~s/\/[^\/]+$//; - $fn=~s/([^\/])$/$1\//; + # Append the name of the uploaded file $fn.=$env{'form.upfile.filename'}; - $fn=~s/^\///; $fn=~s/(\/)+/\//g; - # Fn is the full path to the destination filename. # Check for illegal filename &Debug($r, "Filename for upload: $fn"); @@ -192,20 +188,21 @@ sub phaseone { $r->print('
'.&mt('Illegal filename.').'
'); return; } - +# Split part that I can change from the part that I cannot change + my ($fn1,$fn2)=($fn=~/^(\/priv\/[^\/]+\/[^\/]+\/)(.*)$/); # Display additional options for upload # and upload button $r->print( '