Jump to content
xisto Community
Sign in to follow this  
iGuest

UPLOAD SCRIPT (.php)

Recommended Posts

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.