--- loncom/publisher/lonupload.pm 2010/11/28 00:04:10 1.51 +++ loncom/publisher/lonupload.pm 2011/10/31 01:28:47 1.56 @@ -2,7 +2,7 @@ # The LearningOnline Network with CAPA # Handler to upload files into construction space # -# $Id: lonupload.pm,v 1.51 2010/11/28 00:04:10 raeburn Exp $ +# $Id: lonupload.pm,v 1.56 2011/10/31 01:28:47 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -179,12 +179,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 +189,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( '
' .'' .'' - .'' ); $r->print( &Apache::lonhtmlcommon::start_pick_box() .&Apache::lonhtmlcommon::row_title(&mt('Save uploaded file as')) - .'/priv/'.$uname.'/' - .'' + .''.$fn1.'' + .'' + .'' .&Apache::lonhtmlcommon::row_closure() .&Apache::lonhtmlcommon::row_title(&mt('File Type')) .'