PDA

View Full Version : Saving images in a database.


gigiloumill
07-28-2009, 01:21 PM
Hi, does anyone know how to save images in a database for future retrieval? or perhaps saving the link to it and saving the image itself in a folder? Thanks

Corrosive
07-28-2009, 01:36 PM
same as you would text I think. I think you need to tell SQL that it will be saved as a 'Blob' and then you'd use a file upload form. <<< I could be wrong tho

gigiloumill
07-28-2009, 01:44 PM
The file upload form would be different than the script used to insert text into mysql?

Corrosive
07-28-2009, 02:07 PM
The file upload form would be different than the script used to insert text into mysql?

Yes, I believe so as you are asking to access a user's hard drive for a file upload. I think this takes a little more programming.

edbr
07-29-2009, 01:00 AM
forms for uploading files need to be multipart and a script for uploading is needed . There's plenty around . if you are into using classes i would recommend Olaf Lederers class at http://www.finalwebsites.com/snippets.php?id=7
On another note though personally i would upload files to a directory and just add a link in the database

gigiloumill
07-29-2009, 12:24 PM
That's what I'm trying to do. I want to save file in a folder and save link in the db. I can't figure out how to cut and paste link into the form the field to send. Any suggestions? Thanks

edbr
07-30-2009, 12:59 AM
yes that should be vailable try a yahoogle there will be many upload scripts available there are some quoted on this forum quite recently

gigiloumill
07-30-2009, 02:13 PM
Thanks e, but I still can't figure this out. (it sucks being a nooby). Anyway, I set up a form to send into the db (which is working fine) and I also set up a pagination script to retrieve from the db (also working fine) but, I can't figure out, how to insert the images' path as well into the form for the pagination to retrieve. Any suggestions? Thanks.

edbr
07-31-2009, 01:17 AM
well only by repeating whay ive said. the process of uploading a file is first the form needs to be multipart, the file is uploaded to a folder.
ill have a look later if i can find a script for you but bit short of time at the moment

gigiloumill
07-31-2009, 11:20 AM
Thank you. Can it be tested on local server?

edbr
07-31-2009, 11:29 AM
uploading yes