PHP File Upload@ Shwetank education.com

Script   File_upload.php
HTML code
<form action=”#” method=”post” enctype=”multipart/form-data”>
Upload Files:
<input type=”file” name=”up” id=”up”>

<input type=”submit” name=”btn” value=”Upload File”>
</form>

PHP script
<?
if (isset($_POST[‘btn’]))
{
$uploaddir=’uploads/’;// web root dir name
$uploadfile=$uploaddir.basename($_FILES[‘up’][‘name’]);

if (move_uploaded_file($_FILES[‘up’][‘tmp_name’],$uploadfile))
{
echo”file is valid ! and sucessfully upload”;
}
else
{
echo”not upload ! some error”;
}
}
?>

Output :
Upload Files:   

Notes*
Create folder name uploads in project folder root.

copy html and php script in page name-file_upload.php