1. First of all you will have to create HTML form for uploading any file through PHP

2. Create a folder in which you want to store uploaded files


When we upload a file we need to save file data base as well as in a folder.
Now we are going to do this…


$ext =pathinfo($pic, PATHINFO_EXTENSION);
$sql=move_uploaded_file($_FILES[‘image’][‘tmp_name’],”images/”.$pic); //upload a file in folder

echo “<script>alert(‘Deal Added Succeessfully’);

else {
echo “Image Is Out Of Range”;


mysql_query(“insert into deal(image)values(‘$pic’)”)or die(mysql_error()); //upload a file in database



<form method=”post” action=”” enctype=”multipart/form-data”>
<input type=”file” name=”image” id=”file”/>
<input type=”submit” value=”SUBMIT” name=”submit”>
Note : (enctype=”multipart/form-data”) Do not forget to embeded that code in form.