Re: Re: PHP Security

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I l wrote:
Lets say you want to store someones picture.

In the database, you would insert the picture, who owns that picture, maybe the ip address and request headers of where that picture came from, the category, sub-category, sub-sub-category in which the picture belongs to, etc. You can gather and store as much information about that picture as you want with ease.

I can store all this information in a db without storing the binary image in the table too.


When you want to access that file and its attributes, you only have to do one database query.

I would have to do one query to get the attributes regardless if the image itself was in the db or the filesystem.


Wouldn't you agree that this structure is much easier to manage than storing the file in a directory, then storing that extra information in a database? Then to retrieve, you must do a database query and find the file in the FILESYSTEM (hoping it is still there). The code is much more complex

One if statement...if ( file_exists (...) ); Complex? Not at all. You should be checking it regardless if the image is in the db or not...yes, an image could be deleted off of the filesystem, and it could be deleted out of the db too. Binary data in the db could become corrupt. All kinds of things can happen. Just assuming that you don't have to check your data just because it's coming from a db isn't less complex, it's lazy, and asking for problems.


In the end, it boils down to personal preference, but the filesystem is still better suited to store binary data than a db.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
john@xxxxxxxxxxxx

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux