--- docman.php 2002/07/27 19:27:22 1.6
+++ docman.php 2002/07/27 19:45:28 1.7
@@ -1606,18 +1606,19 @@
switch ($HTTP_POST_VARS["POSTACTION"]) {
case "UPLOAD" :
$FN_name=stripSlashes($HTTP_POST_FILES["FN"]["tmp_name"]);
+ $FN=stripSlashes($HTTP_POST_FILES["FN"]["name"]);
if (!is_writeable($fsDir)) Error("Write denied",$relDir) ;
- if (strstr($FN_name,"/"))
- Error("Non-conforming filename") ;
- // TODO : should rather check for escapeshellcmds
- // but maybe RFC 18xx asserts safe filenames ....
+
$source = $FN_name ;
if (! file_exists($source)) {
Error("You must select file with browse to upload it!");
}
+
$FILENAME = $HTTP_POST_VARS["FILENAME"];
+ if (strstr($FILENAME,"/"))
+ Error("Upload error","Non-conforming filename. Filename $FILENAME has slashes (/) in it.") ;
if (! isset($FILENAME)) { // from update file
- $target = "$fsDir/$FN_name" ;
+ $target = "$fsDir/".basename($FN_name);
} else {
$target = "$fsDir/$FILENAME";
}