>I am creating a system to allow users to upload images to the site.
>Would it be better to store the images in a MySQL table, or having it
>save the images to a directory on the server?  Anyone have any
>suggestions on this? Pros? Cons?

Depends on the details of your situation - I've generally preferred to
store image in the filesystem. A few hosts I've used have administrative
limits on the size of a BLOB field, so storing images in the filesystem
was mandatory.

If those images are stored within the docroot, you can also just refer to
them by URI and let Apache handle all the appropriate headers and such, or
if you're strapped for CPU you can even use a completely different
webserver (thttpd, apache without PHP, etc.) to serve them.

If they're stored in the database or outside the docroot, you can control
access to them more easily. Keeping them in the database also means that
you don't have to worry about various filesystem considerations, like
keeping a world-writeable directory or potential undesired access from
others users in a shared hosting environment.

---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca            http://mike.teczno.com/contact.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to