--- loncom/publisher/lonupload.pm	2001/05/25 17:03:58	1.4
+++ loncom/publisher/lonupload.pm	2001/08/22 18:13:20	1.7
@@ -15,7 +15,7 @@
 #
 # 03/31,04/03 Gerd Kortemeyer)
 #
-# 04/05,04/09,05/25 Gerd Kortemeyer
+# 04/05,04/09,05/25,06/23,06/24,08/22 Gerd Kortemeyer
 
 package Apache::lonupload;
 
@@ -45,13 +45,15 @@ sub upfile_store {
 
 
 sub phaseone {
-    my ($r,$fn,$uname,$udom)=@_;
+   my ($r,$fn,$uname,$udom)=@_;
+   $ENV{'form.upfile.filename'}=~s/\\/\//g;
+   $ENV{'form.upfile.filename'}=~s/^.*\/([^\/]+)$/$1/;
+   if ($ENV{'form.upfile.filename'}) {
     $fn=~s/\/[^\/]+$//;
     $fn=~s/([^\/])$/$1\//;
     $fn.=$ENV{'form.upfile.filename'};
     $fn=~s/^\///;
     $fn=~s/(\/)+/\//g;
-
     if (($fn) && ($fn!~/\/$/)) {
       $r->print(
  '<form action=/adm/upload method=post>'.
@@ -64,6 +66,9 @@ sub phaseone {
   } else {
       $r->print('<font color=red>Illegal filename.</font>');
   }
+ } else {
+     $r->print('<font color=red>No upload file specified.</font>');
+ }
 }
 
 sub phasetwo {
@@ -112,9 +117,10 @@ sub handler {
   my $uname;
   my $udom;
 
-  unless (($uname,$udom)=
+  ($uname,$udom)=
     &Apache::loncacc::constructaccess(
-             $ENV{'form.filename'},$r->dir_config('lonDefDomain'))) {
+			 $ENV{'form.filename'},$r->dir_config('lonDefDomain'));
+  unless (($uname) && ($udom)) {
      $r->log_reason($uname.' at '.$udom.
          ' trying to publish file '.$ENV{'form.filename'}.
          ' - not authorized', 
@@ -162,3 +168,6 @@ sub handler {
   $r->print('</body></html>');
   return OK;  
 }
+
+1;
+__END__