iGuest 3 Report post Posted January 19, 2005 Upload script <?if ($mode == "upload") {function getPath() { global $SCRIPT_FILENAME; $tmp = split("[/]",$SCRIPT_FILENAME); $tmp = $tmp[count($tmp)-1]; $tmp = str_replace($tmp,"",$SCRIPT_FILENAME); return $tmp;}print "Text coming with file : $myText<br/>n";print "<hr/>n";print "Temporary Remote Path : " . $HTTP_POST_FILES["myFiles"]["tmp_name"][0]."<br/>n";print "Uploaded File Name : " . $HTTP_POST_FILES["myFiles"]["name"][0]."<br/>n";print "Uploaded File Size : " . $HTTP_POST_FILES["myFiles"]["size"][0]."<br/>n";print "Uploaded File Mime Type : " . $HTTP_POST_FILES["myFiles"]["type"][0]."<br/>n";print "Path to Script : " . getPath() . "<br>n";print "<hr/>n";print "Temporary Remote Path : " . $HTTP_POST_FILES["myFiles"]["tmp_name"][1]."<br/>n";print "Uploaded File Name : " . $HTTP_POST_FILES["myFiles"]["name"][1]."<br/>n";print "Uploaded File Size : " . $HTTP_POST_FILES["myFiles"]["size"][1]."<br/>n";print "Uploaded File Mime Type : " . $HTTP_POST_FILES["myFiles"]["type"][1]."<br/>n";print "Path to Script : " . getPath() . "<br>n";print "<hr/>n";print "Temporary Remote Path : " . $HTTP_POST_FILES["myFiles"]["tmp_name"][2]."<br/>n";print "Uploaded File Name : " . $HTTP_POST_FILES["myFiles"]["name"][2]."<br/>n";print "Uploaded File Size : " . $HTTP_POST_FILES["myFiles"]["size"][2]."<br/>n";print "Uploaded File Mime Type : " . $HTTP_POST_FILES["myFiles"]["type"][2]."<br/>n";print "Path to Script : " . getPath() . "<br>n";print "<hr/>n";$savePath = getPath() . "tmp/";$isValidUpload = move_uploaded_file ($HTTP_POST_FILES["myFiles"]["tmp_name"][0], $savePath . $HTTP_POST_FILES["myFiles"]["name"][0]);if ($isValidUpload){ print "Upload success !";}$isValidUpload = move_uploaded_file ($HTTP_POST_FILES["myFiles"]["tmp_name"][1], $savePath . $HTTP_POST_FILES["myFiles"]["name"][1]);if ($isValidUpload){ print "Upload success !";}$isValidUpload = move_uploaded_file ($HTTP_POST_FILES["myFiles"]["tmp_name"][2], $savePath . $HTTP_POST_FILES["myFiles"]["name"][2]);if ($isValidUpload){ print "Upload success !";}}else {?><html><head><title>Upload Multiple Files</title></head><body><form action="upload_script.php" method="post" enctype="multipart/form-data"> <input type="text" name="myText" value="Coucou le monde !"/><br/> Local File Path 1 : <input type="file" size="60" name="myFiles[]"/><br/> Local File Path 2 : <input type="file" size="60" name="myFiles[]"/><br/> Local File Path 3 : <input type="file" size="60" name="myFiles[]"/><br/> <input type="hidden" name="max_file_size" value="500000"/> <input type="submit" value="Upload"/></form></body></html><?}?> Share this post Link to post Share on other sites
iGuest 3 Report post Posted January 19, 2005 sweet,. thanks.it uploads to the same folder as the script yeah?how do you change it? Share this post Link to post Share on other sites
iGuest 3 Report post Posted January 19, 2005 jamez, Nice but what about n00bs that may want to know whats going on. You may want to add some comments in the php file. Share this post Link to post Share on other sites