5
Contributors
10
Replies
25
Views
3 Years
Discussion Span
Last Post by urtrivedi
0

You could do that, but why don't you just save the image on the server, and save a link to it in the database, which you can use to display the image? :)

Oh, and what is it that you are asking, exactly?

0

Thanks for you reply
What exactly i need is i want store the image in database and that image will be display when i login to my account.

0

I am beginer of php.
Now only i have learned inserting deleting and implemented in my website now i need to insert image,,

0

I am beginer of php.
Now only i have learned inserting deleting and implemented in my website now i need to insert image,,

What is your logic behind wanting to store the image within the database system instead of the regular file system? It's not that it's impossible (or even difficult), but that we want to ensure you're doing it for the right reasons. You've said it yourself: you're new to PHP. Help us help you by answering our questions.

0
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head></head>
<body>

<?php
    $username=$_REQUEST['Name'];
    $image = file_get_contents($_FILES['image']['tmp_name']);
     $image = addslashes($image);
   // $conn=mysql_connect("localhost","root","******") or die('Error');
   // mysql_select_db("oracle",$conn) or die('Error');
    include "consam.php";
    $sql="INSERT INTO sample1 (Name,image)//image attribute in DB is blob type.
            VALUES ('$username','$image')";
    mysql_query($sql,$conn);
    mysql_close($conn);

?>
    <form method="post" action="test1.php" enctype="multipart/form-data">
    Username :<input type="text" name="Name"/><br>
    Upload Image :<input type="file" name="image" id="file"><br>
    <input type="submit" value="Submit"/>
     </form>

</body>
</html>

I have this code but it not working

0

Thanks Bob Hensley Sir
My logic i want create student and staff biodata form and storetheir detail in database. For the bio date i want insert their profile picture in their biodata

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.