1

Hi I'm trying to add my image name to my database, I have a page that adds a file to my server in a folder called uploads but I then want to be able to on creation of a news article, get the image name that I've uploaded and add that to the relevant article in a variable called $Image_Name so I can show the relevant image to the article.

is there some code I can add to my form to search browse the image and add the name to a field then when I do my insert query on the following page just get that value like I do for all my text fields.

Any help would be great as I still very new to php and mysql.

thanks.

1

1 Answer 1

2

Maybe this will help you:

$image = $_FILES["file"]["name"];                                               
move_uploaded_file($_FILES["file"]["tmp_name"],"../upload/$image");                                             
$query = "INSERT INTO images VALUES('','$image')";
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.