Hello everyone. I'm looking for a script that will not only upload an image (jpeg or gif) to my webspace but also save it's information into my MYSQL database. The information I want the DB to save is the images *new* file name, the user who uploaded the image, and the title (which I want the user to be allowed to name) for diplaying purposes.
I've been reading around and many people suggest not using the BLOB method. But then again I read that a lot people would suggest the BLOB method. Basically what I'm going for is an easy script that my registered users can access to upload images onto their own personal profile.
Any scriplets, links, or any leads of any kind would be greatly appreciated!
06-26-2005, 03:08 PM
Assuming small images, I'd go with a standard mediumtext field with base64 encoding. But if its larger images, perhaps blob would be your best bet.
Personally, I use blob, but I tend to use larger images as well.
This is a simple task.
Now, controlling images on your filesystem may be the tougher aspect. It depends on what you allow, how large, how many, how many users, etc.
First thing to remember is that you don't want to overwrite an already existing image, unless thats the purpose of it. Second thing is security. Never allow users to upload anything within your web root, place it above your html_docs instead.
However, I'd say go with one or the other; you don't need your image to be stored in your database if you have it as a file, and vice versa. Database can still be used, but instead of the information instead save it as a path_to_image.
All and all, I'd personally say go with the complete database route. Though I know of people whom have had problems with a database stored image, it depends on how you do it.
First, decide on what you would like to do exactly, then we'll be able to help you script something up.
Okay. I've decided that I want to use the BLOB method. But I'm not too familiar with how it works. I'm sure if I read a couple tutorials or what not I could get the jist of it.
Like I said before, I want registered users to be able to upload their own photos into their own personal photo gallary and it seems that using the BLOB method would be the most organized.
Any suggestions, scriplets, or leads?