Page 1 of 1

PHP upload a file Help!

Posted: 14 Mar 2014, 21:37
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