Page 1 of 1

uploading pictures

Posted: Mon Jun 14, 2004 8:44 pm
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!

Posted: Mon Jun 14, 2004 9:25 pm
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.

Posted: Tue Jun 15, 2004 12:38 am
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!

Posted: Tue Jun 15, 2004 12:42 am
by snpo123

Posted: Tue Jun 15, 2004 8:10 am
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].