In this tutorial, we will learn how to upload an Image into any folder using PHP.
First of all create one PHP page and make form for uploading image.
Note :- Don't for get to create upload folder where the image will store and copy the below code and paste in the page then run into the browser using localhost WAMP server or XAMP server.
Note :- Dont forget to use ( enctype="multipart/form-data" ) in the form tag. it is used for uploading media files on server with server permission.
if you face any difficulty for using it then contact me from contact form. I will reply you surely.
and if you want any type of blogging or Ad-sense tips then you can also contact me.
First of all create one PHP page and make form for uploading image.
Note :- Don't for get to create upload folder where the image will store and copy the below code and paste in the page then run into the browser using localhost WAMP server or XAMP server.
$target="Upload_folder/";
$target= $target.basename($_FILES['file']['name']);
$img_name=basename($_FILES['file']['name']);
if(move_uploaded_file($_FILES['file']['tmp_name'],$target))
{
echo "The Image name ".basename($_FILES['file']['name'])." has been uploaded into the Upload folder";
}
else
{
echo "Uploading Error";
}
?>
Note :- Dont forget to use ( enctype="multipart/form-data" ) in the form tag. it is used for uploading media files on server with server permission.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form action="" name="upload" enctype="multipart/form-data" method="post">
image <input type="file" name="file" id="file" /><br/><br/>
<input type="submit" name="submit" id="submit" />
</form>
</body></html>
if you face any difficulty for using it then contact me from contact form. I will reply you surely.
and if you want any type of blogging or Ad-sense tips then you can also contact me.
0 comments :
Post a Comment