PHP upload a file Help!

A Place For Programmers Of All Levels To Discuss Programming & Web Building.

Moderator: Community Moderator

Post Reply
Banderass
Sergeant First Class
Sergeant First Class
Posts: 155
Joined: 19 Nov 2009, 16:22

PHP upload a file Help!

Post by Banderass »

html file (uploadFile.htm)

Code: Select all

<html>
	<body>
		<form actiom="upload_file.php" method="post" enctype="multipart/form-data">
			<lable for="file">Filename:</lable>
			<input type="file" name="file" id="file" size="80"><br>
			<input type="submit" name="submit" value="submit">
		</form>
	

	</body>
</html>

php file (upload_file.php)

Code: Select all

		<?php
		$file_result="";
		if ($_FILES["file"]["error"] > 0)
		{
 		echo "Error: " . $_FILES["file"]["error"] . "<br>";
 		}
		else
 		{
 		echo "Upload: " . $_FILES["file"]["name"] . "<br>";
 		echo "Type: " . $_FILES["file"]["type"] . "<br>";
 		echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
 		echo "Stored in: " . $_FILES["file"]["tmp_name"];
 		}
		?>
	
note that the uploaded file is not saved i just want to show the info about it (size,type...) and the two files are in the same directory
thank you for your help
Last edited by Banderass on 15 Mar 2014, 08:12, edited 1 time in total.
I AM A VERY BAD MAN
Post Reply

Return to “Programming/Web Building Chat & Support”