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!
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?
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.
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].