file uploading in php

file uploading in php 


Example of file uploading in php
html part
<html>


<body>



<form action="upload.php" method="post" enctype="multipart/form-data">

<label for="logo">Filename:</label>

<input type="file" name="logo" id="logo" />

<br />

<input type="submit" name="submit" value="Submit" />

</form>



</body>

</html>
 
php script
<?php


if ($_FILES["logo"]["error"] > 0)

{

echo "Error: " . $_FILES["logo"]["error"] . "<br />";

}

else

{

echo "Upload: " . $_FILES["logo"]["name"] . "<br />";

echo "Type: " . $_FILES["logo"]["type"] . "<br />";

echo "Size: " . ($_FILES["logo"]["size"] / 1024) . " Kb<br />";

echo "Stored in: " . $_FILES["logo"]["tmp_name"];

}

?>