Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8702329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:37:34+00:00 2026-06-13T02:37:34+00:00

i want to store an image in database not by inserting but by updating

  • 0

i want to store an image in database not by inserting but by updating (by using UPDATE query).

Everything else is updated successfully but its not storing image. I’m using medium blob data type to store image.

Here is my code:

update-profile.php:

  <form id="form" method="post" action="update-profile-action.php"   enctype="multipart/form-data">
    <label for="Fname">First Name:</label> <input type="text" id="Fname" class="text"  value="<?php echo $firstname; ?>" name="Fname" /> <br /><br />
     <label for="Lname">Last Name:</label> <input type="text" id="Lname" class="text"    value="<?php echo $lastname; ?>" name="Lname" /><br /> <br />

<?php 
if ($_SESSION["type"]=="T")
{
?>        
    <label>Profile Image:</label> <input type="file" name="image" value="" /><br     />     <br />
     <label>Qualification:</label><textarea name="qualification" class="text"  id="qualification"><?php echo $qualification;?></textarea><br /><br />
    <label>Education & Teaching History:</label> <textarea name="briefintro"     class="text" id="intro"><?php echo $briefintro; ?></textarea><br /><br />
<?php
}
?>
    <input type="submit" class="mybutton" value="Update Profile" />

</form>

update-profile-action.php:

<?php include("../includes/config.php");?>
<?php
$Fname=$_POST["Fname"];
$Lname=$_POST["Lname"];
$image=$_POST["profileimg"];
$briefintro=$_POST["briefintro"];
$qualification=$_POST["qualification"];

$con=mysql_connect($dbserver,$dbusername,$dbpassword);
if (!$con) { die('Could not connect: ' . mysql_error()); }
mysql_select_db($dbname, $con);
$query=("UPDATE accounts SET firstname='".$Fname."' , lastname='".$Lname."' ,  profileimg='".$image."' ,  briefintro='".$briefintro."',    qualification='".$qualification."' WHERE id=".$_SESSION['id']);
$result = mysql_query($query);
header("Location: update-profile.php?status=3");
mysql_close($con);
?>

i copied only the related data from update-profile.php to making it more easy to read 🙂
any kind of help will be appreciated 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T02:37:35+00:00Added an answer on June 13, 2026 at 2:37 am

    Two problems:

    You do not have an id for the input tag for the file. You need to change <input type="file" name="image" value="" /> to <input type="file" name="image" value="" id = "profileimage" />

    Secondly you access files not via $_POST but rather via $_FILES.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to store Image into a SQLite Database in Blackberry.. so what i
I am capturing image using canvas and i want to store a captured image
I want to store an image in my SQLITE db. I checked out the
When I click on an image, I want to store that particular images src
I want to access an image stored in Blackberry, say at location store/home/user/image.png .
I want to download image from url and store in sdcard's folder. If folder
i want to retrieve image stored in mysql as path using php and display
I want to retrieve/query images stored by joomla k2 component (under the Image Tab).
I want to store certain items in the database with variable amount of properties.
I've got a byte array for an image (stored in the database). I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.