--- loncom/publisher/lonupload.pm	2003/08/04 17:45:06	1.18
+++ loncom/publisher/lonupload.pm	2003/08/04 18:22:55	1.19
@@ -2,7 +2,7 @@
 # The LearningOnline Network with CAPA
 # Handler to upload files into construction space
 #
-# $Id: lonupload.pm,v 1.18 2003/08/04 17:45:06 www Exp $
+# $Id: lonupload.pm,v 1.19 2003/08/04 18:22:55 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -163,6 +163,8 @@ sub phasetwo {
  '<font color=red>'.
  'The extension on this file is reserved internally by LON-CAPA.'.
  '</font>');
+              $r->print('<p><font size=+2><a href="'.$path.
+                        '">Back to Directory</a></font>');
 	   } elsif ($fn=~/\.(\w+)$/ && 
 		    !defined(&Apache::loncommon::fileembstyle($1))) {
 	       $r->print(
@@ -170,6 +172,16 @@ sub phasetwo {
  '<font color=red>'.
  'The extension on this file is not recognized by LON-CAPA.'.
  '</font>');
+	       $r->print('<p><font size=+2><a href="'.$path.
+                        '">Back to Directory</a></font>');
+	   } elsif (-d $target) {
+	       $r->print(
+ 'File <tt>'.$fn.'</tt> could not be copied.<br />'.
+ '<font color=red>'.
+ 'The target is an existing directory.'.
+ '</font>');
+	       $r->print('<p><font size=+2><a href="'.$path.
+                        '">Back to Directory</a></font>');
 	   } elsif (copy($source,$target)) {
 	       chmod(0660, $target); # Set permissions to rw-rw---.
 	      $r->print('File copied.');
@@ -179,17 +191,17 @@ sub phasetwo {
                         '">Back to Directory</a></font>');
 	   } else {
               $r->print('Failed to copy: '.$!);
+              $r->print('<p><font size=+2><a href="'.$path.
+                        '">Back to Directory</a></font>');
 	   }
        }
     } else {
        $r->print(
-   '<font size=+1 color=red>Please pick a filename</font><p>');
-       &phaseone($r,$fn,$uname,$udom);
+   '<font size=+1 color=red>Please use browser "Back" button and pick a filename</font><p>');
     }
   } else {
     $r->print(
-   '<font size=+1 color=red>Please pick a filename</font><p>');
-    &phaseone($r,$fn,$uname,$udom);
+   '<font size=+1 color=red>Please use browser "Back" button and pick a filename</font><p>');
   }
 }