Page 1 of 1
Handling images...
Posted: Mon Jan 21, 2008 5:24 pm
by arpowers
Hey everyone,
I have a bunch of questions regarding the CRUD aspect of handling a directory based image system on a site.
Can someone point me to a good resource on this?
for instance:
how do you auto-increment photo id's that your uploading?
what are the security risks?
anyway, any help is always appreciated:)
Andrew
Re: Handling images...
Posted: Mon Jan 21, 2008 5:54 pm
by Christopher
Do you want a filesystem only implementation, or are you going to use a database to track the images?
Re: Handling images...
Posted: Mon Jan 21, 2008 7:20 pm
by arpowers
yes, I will be tying it in with a DB...
AP
Re: Handling images...
Posted: Mon Jan 21, 2008 7:35 pm
by Christopher
Then you can get the last insert id from the table (or sequence) to use as a unique number.
Re: Handling images...
Posted: Mon Jan 21, 2008 7:45 pm
by arpowers
Thanks! ya! that works I guess I didnt think about it that way.....
what are the other concerns in working with directory based content like this?
Ap
Re: Handling images...
Posted: Mon Jan 21, 2008 7:59 pm
by Christopher
Make sure you use move_uploaded_file() (or whatever it is called) to the filename you generate. File type checking has been covered in these forums, you can search and get good information. It may require multiple calls to identify a file. There is a class around here somewhere that identifies a number of types. And you will need to have some rollback code in case the move or insert does not work.