[wp-hackers] file upload: why actual files?

Michael Leuchtenburg michael at slashhome.org
Sun Sep 19 16:05:57 UTC 2004


Amit Gupta wrote:
> Well, I don't think that files should be uploaded to database instead of 
> a directory. If a thing can be done, it doesn't mean that it has to be 
> done. The biggest drawback of uploading files to database is that 
> there's no cacheing of files. If a file is stored on the disk as it is, 
> then whenever a user requests that file, its cached at the user's ISP so 
> that if another user with that same ISP requests that file, its 
> delivered much quickly & also there's little load on the host server.
> But if a file is stored in the database, the file's date changes 
> everytime its requested by a client & thus its not cached at the ISP's 
> server, meaning that its a burden on both the client & the host server.

No, it can be cached by proxies and such. It would be easy to set it up 
such that, say, 
http://example.com/file.php/312cc8a6f2a00107b88a130304865ce1 loads some 
specific file from the DB. Or it can be a prettier URL - that's just an 
example. It can be handled just like a file by any proxies. Just because 
something is coming from a database doesn't mean it can't be cached. 
Even the front page of a blog, or a feed, can be cached if it serves the 
correct headers up.

Also, there is caching of files in memory. The DB handles that bit.

> Then there's the issue of MySQL being able to support BLOBs & large 
> files or not, I'm not sure about that, but thats a minor issue compared 
> to the one outlined above. You may have a super fast DSL Connection, but 
> I & quite a lot of others are still on poor 64Kbps connections. ;)

It does support them just fine. A LONGBLOB can hold up to 4GB. A 
MEDIUMBLOB can hold up to 16MB. I'd say LONGBLOB, because someone might 
want to post videos, or long audio segments.

-- 
Michael Leuchtenburg  |  http://slashhome.org/
cell: 413.433.0739



More information about the hackers mailing list