"; echo " "; echo " "; echo ""; } else { //2 or more files/folders were uploaded... for ($UploadFileCount3=0;$UploadFileCount3 != $FileTotalCount;$UploadFileCount3++) { //======================================================================================================================= //Script to strip out the unwanted filepath and do the filepath conversion based on the client's O/S and Webserver O/S... //======================================================================================================================= $file['name'][$UploadFileCount3] = substr(urldecode($file['name'][$UploadFileCount3]),$FilePathLen,strlen(urldecode($file['name'][$UploadFileCount3]))); //Better not to use the str_replace() since it's a possibility that $FilePath may match part of the filename... //If the webserver is UNIX/LINUX then do this... if ($WebServerFileSystem == "UNIX/LINUX") { //Convert DOS filepath to UNIX/LINUX filepath... $file['name'][$UploadFileCount3] = str_replace("\\","/",$file['name'][$UploadFileCount3]); $WebServerDOSorUnixFileSytemQQ = "/"; } else if ($WebServerFileSystem == "DOS/WINDOWS") { $file['name'][$UploadFileCount3] = str_replace("/","\\",$file['name'][$UploadFileCount3]); $WebServerDOSorUnixFileSytemQQ = "\\"; } //======================================================================================================================= //====================================================================== //Script to create directory folders and place files on the webserver... //====================================================================== $pos = strrpos($file['name'][$UploadFileCount3],$WebServerDOSorUnixFileSytemQQ); //PHP function is strrpos(), not strpos()... if ($WebServerFileSystem == "UNIX/LINUX") { //========================================================================================================================== //Example code of chmod() that worked through PHP, not the same as using shell script through the dumb terminal or telnet... //========================================================================================================================== /* chmod("/somedir/somefile", 644); //Note: decimal; probably incorrect chmod("/somedir/somefile", "u+rw,go+r"); //Note: string; incorrect chmod("/somedir/somefile", 0644); //Note: octal; correct value of mode */ //========================================================================================================================== //=================================================================================================================================== //Another example code for mkdir() that worked through PHP, not the same as using shell script through the dumb terminal or telnet... //Again, chmod() feature is built-in to the mkdir()... //=================================================================================================================================== /* mkdir("/somedir/somefile", 755); //Note: decimal; probably incorrect mkdir("/somedir/somefile", "u+rwx,go+rx"); //Note: string; incorrect mkdir("/somedir/somefile", 0755); //Note: octal; correct value of mode */ //=================================================================================================================================== if (!($pos === false)) { //Note: strrpos() in PHP 4.0b3 and newer, note our use of ===, simply == would not work as expected because the 1st character's position was the 0th (first) character... //Filename with filepath, so attempt to create director(ies) if there isn't one(s) on the webserver $UploadDirectoryPath1 = dirname($file['name'][$UploadFileCount3]); $UploadFileName = basename($file['name'][$UploadFileCount3]); $UploadDirectoryArray = array(); //To wipe out the old data... $UploadDirectoryArray = explode($WebServerDOSorUnixFileSytemQQ,$UploadDirectoryPath1); $UploadDirectoryArrayCount = count($UploadDirectoryArray); if ($UploadDirectoryArrayCount == 1) { clearstatcache(); $ZzTempDirPath = $UploadDirectoryArray[0]; if (is_dir($SavedPath.$ZzTempDirPath) != true) { mkdir($SavedPath.$ZzTempDirPath,0755); } } else { for ($UploadDirCount1=0;$UploadDirCount1<$UploadDirectoryArrayCount;$UploadDirCount1++) { clearstatcache(); //echo $UploadDirCount1; if ($UploadDirCount1 == 0) { $ZzTempDirPath = $UploadDirectoryArray[0]; } else { $ZzTempDirPath .= "/".$UploadDirectoryArray[$UploadDirCount1]; } //echo $ZzTempDirPath." ***"; if (is_dir($SavedPath.$ZzTempDirPath) != true) { mkdir($SavedPath.$ZzTempDirPath,0755); } } } //Filename with no filepath, so place it here. Overwrite it if it exist on the webserver... move_uploaded_file($file['tmp_name'][$UploadFileCount3],$SavedPath.$ZzTempDirPath."/".$UploadFileName); //Can use the if-statement to check the file extension and set a different file permission based on it... chmod($SavedPath.$ZzTempDirPath."/".$UploadFileName,0644); } else { //Filename with no filepath, so place it here. Overwrite it if it exist on the webserver... move_uploaded_file($file['tmp_name'][$UploadFileCount3],$SavedPath.$file['name'][$UploadFileCount3]); //Can use the if-statement to check the file extension and set a different file permission based on it... chmod($SavedPath.$file['name'][$UploadFileCount3],0644); } echo ""; echo " "; echo " "; echo ""; } else if ($WebServerFileSystem == "DOS/WINDOWS") { //Need to write some codes for DOS/WIndows filesystem since they don't use chown, chmod, etc... } //====================================================================== } } //=========================================================================================================== if(!isset($SavedPath)||$SavedPath=="") { echo ""; echo ""; } ?>
File(s)/Folder(s) Uploaded
  Filepath Name File Size
  ".$file['name'][0]."".$file['size'][0]."
  ".$file['name'][$UploadFileCount3]."".$file['size'][$UploadFileCount3]."
 
Files have not been saved, please edit uploader_response.php to match your configuration