By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,303 Members | 1,260 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,303 IT Pros & Developers. It's quick & easy.

Automatically inserting image name in database

P: 4
hi guys,
I am totally new to coding so please bare with me.
I have a file upload field in a form on a PHP page for users to upload pictures, i also have the following fields in my MySQL database

"image_folder" - this contains a default value of the image folder in my root folder

"image_path" - this automatically combines the image_ folder with the image_name to generate the path to the users image

"image_name" - i want this field to contain the name of the users image

Does anyone know how i would be able to "grab" the file name and automatically inserts it in the image _name field when the file is uploaded.

Cheers for any advice
Oct 1 '08 #1
Share this Question
Share on Google+
3 Replies


MarkoKlacar
Expert 100+
P: 296
Hi,

That's pretty basic, you should find tutorials on that all over the Internet....
You could start here

What you should really look into is how you store images in the MySQL database, that would be the "correct" way to display images stored (well not really stored in your case) in a DB...

/MK
Oct 1 '08 #2

P: 4
Hi,


What you should really look into is how you store images in the MySQL database, that would be the "correct" way to display images stored (well not really stored in your case) in a DB...

/MK
I briefly looked into storing the images on MySQL but the DB would be too big so the only way to do it would be storing the path.

Thanks for the link, i am trying it out.
Oct 1 '08 #3

Markus
Expert 5K+
P: 6,050
You can get the image name by

Expand|Select|Wrap|Line Numbers
  1. $_FILES['uploaded']['name']
You would have to adapt 'uploaded' to be the name of the file input.
Oct 2 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.