--- loncom/publisher/lonupload.pm 2011/10/23 23:46:07 1.54 +++ loncom/publisher/lonupload.pm 2011/10/26 22:38:49 1.55 @@ -2,7 +2,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.55 2011/10/26 22:38:49 www 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')) .'