<?php
//There is no validation on type of extension that Will be mentioned in next post ......
//Any queries post comment
//THIS IS PHP CODE FOR SUBMIT OF THE FORM AND VALIDATION
$message="Welcome";
if(!empty($_POST['submit']))
{
if(empty($_FILES["profile_pic"]["name"]))
{
$message="Select File to Upload";
}
else
{
echo "Upload: " . $_FILES["profile_pic"]["name"] . "<br>";
echo "Type: " . $_FILES["profile_pic"]["type"] . "<br>";
echo "Size: " . ($_FILES["profile_pic"]["size"] / 1024) . " kB<br>";
echo "Stored in: " . $_FILES["profile_pic"]["tmp_name"];
move_uploaded_file($_FILES["profile_pic"]["tmp_name"],
"images/" . $_FILES["profile_pic"]["name"]);
echo "Stored in: " . "images/" . $_FILES["profile_pic"]["name"];
$message="Uploaded in folder Successfully";
{
//Your DB CONNECTION GOES HEREEEEE
//Your Query Goes here ----------
//And Your Image has been saved to database after query and To Image folder you will see your image in Server
}
}
}
?>
<div>
<!------------THIS IS FORM WHERE FILE IS PRESENT-------------->
<div id="myDiv"><?php echo $message;?></div>
<form id="add_info" name="add_info" method="post" enctype="multipart/form-data">
Upload your Image :
<input type="file" name="profile_pic" id="profile_pic">
<input type="submit" name="submit" id="submit" value="submit">
</form>
</div>
//There is no validation on type of extension that Will be mentioned in next post ......
//Any queries post comment
//THIS IS PHP CODE FOR SUBMIT OF THE FORM AND VALIDATION
$message="Welcome";
if(!empty($_POST['submit']))
{
if(empty($_FILES["profile_pic"]["name"]))
{
$message="Select File to Upload";
}
else
{
echo "Upload: " . $_FILES["profile_pic"]["name"] . "<br>";
echo "Type: " . $_FILES["profile_pic"]["type"] . "<br>";
echo "Size: " . ($_FILES["profile_pic"]["size"] / 1024) . " kB<br>";
echo "Stored in: " . $_FILES["profile_pic"]["tmp_name"];
move_uploaded_file($_FILES["profile_pic"]["tmp_name"],
"images/" . $_FILES["profile_pic"]["name"]);
echo "Stored in: " . "images/" . $_FILES["profile_pic"]["name"];
$message="Uploaded in folder Successfully";
{
//Your DB CONNECTION GOES HEREEEEE
//Your Query Goes here ----------
//And Your Image has been saved to database after query and To Image folder you will see your image in Server
}
}
}
?>
<div>
<!------------THIS IS FORM WHERE FILE IS PRESENT-------------->
<div id="myDiv"><?php echo $message;?></div>
<form id="add_info" name="add_info" method="post" enctype="multipart/form-data">
Upload your Image :
<input type="file" name="profile_pic" id="profile_pic">
<input type="submit" name="submit" id="submit" value="submit">
</form>
</div>
No comments:
Post a Comment