php - Getting the image file into the file field while updating record

//Get Form Data from Data base against the Id
$Edit_Query="SELECT * FROM products WHERE id='$Id'";

Now I echoed all variable into my input fields... Please note that['product_picture'] is the file name only ... physical file is uploaded in to my uploads folder... Now i want to get that physical file automatically into my file if user just change other fields and hit update button ... it will update the rest of the record and file should be remained as it is in the folder as well as db with that particular$ID.

I tried<input type="file" name="product_picture" value="<php echo $File_Name; ?>"> but it is not even echoing the file name....

In simple words its like User want to update the record but its not necessary that he must have to update the file too.... it should be on choice ..




Try this,

Use a hidden field to store the image ID in,

<input type="hidden" name="image_id" value="image_id">

Then you can use it to assign the new image the previous ID and not have to update the SQL database.

People are also looking for solutions to the problem: php - Mediawiki stopping a page from saving and redirecting back to edit page with an error message


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.