1. u can put the photos in a directory on the server and keep their url's in the database. this is the recommended and faster way
2. u can store the pictures in the database (as blob)
u may take a look at hotscripts.com for example to download some existing scripts that will do the job. u dont need to re-invent the wheel if u dont feel like it.