uploading pictures

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
C_Calav
Forum Contributor
Posts: 395
Joined: Wed Jun 02, 2004 10:55 pm
Location: New Zealand

uploading pictures

Post by C_Calav »

hi guys,

i have a insert admin page that inserts product info into the database.
each product has a picture, but i am not keeping the pictures in the database, just the picture filename. i am keeping the pictures in a file directory.

at the moment i am not uploading pictures in the admin page as i am not keeping them in the database.

my question is, is there a way to add "upload picture" to my admin insert page and have the picture upload to the file directory instead of the databse? or should i be storing all the pics in the database?

at the moment i have to upload all the pics through ftp to go to my website.


any help would be great. am i doing this the right way so far?

thanx! sorry if this is confusing!
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

Of course there is, you just have to add a field to upload a file to the form. Look at recent forum posts about file uploads, or the php manual to learn more.
User avatar
C_Calav
Forum Contributor
Posts: 395
Joined: Wed Jun 02, 2004 10:55 pm
Location: New Zealand

Post by C_Calav »

thanx for the help guys!

but my question is still unsolved!

is there a way to upload images to a folder on your website.

i do not want to store the images in the database, just the filenames.

at the moment once i have inserted all the product info, i have to go up load all the photos.

thanx!
User avatar
snpo123
Forum Commoner
Posts: 77
Joined: Sat Apr 17, 2004 6:31 pm

Post by snpo123 »

PAW Projects
Forum Commoner
Posts: 30
Joined: Tue Jun 15, 2004 7:43 am
Contact:

Post by PAW Projects »

Make sure to add enctype="multipart/form-data" to your HTML form though.

After uploading a file, you can access it using the $_FILES array.
You can copy it manually (from $_FILES[$name]['tmp_name'] to wherever), or use the PHP function [php_man]move_uploaded_file[/php_man].
Post Reply