Menu

Sunday, September 21, 2014

How to upload image in php












upload.php
-------------------


<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<?php
$path="img/";
    //img   /----> you can specify the path where you can save image


$path=$path.basename($_FILES['img']['name']);


move_uploaded_file($_FILES['img']['tmp_name'],$path);
?>
<body>
<form method="post" enctype="multipart/form-data">
<input type="file" name="img">
<input type="submit" name="Upload" value="upload">

</form>
</body>
</html>

No comments:

Post a Comment