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

Amit Gupta amit at igeek.info
Sun Sep 19 14:21:35 UTC 2004


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.

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. ;)

If you want to associate files with individual posts, it still can be done. All it requires is another field along with the ones in the table that contains the post content. This field can hold an array of all file names associated with the post. Its as simple as that. :)


-----
Amit





---------- Original Message from michael at slashhome.org ----------

Is there a design reason for Wordpress to upload files to a directory, 
rather than putting them in the database? It seems to me that it would 
make more sense to put them in the database, possibly associated with 
individual posts. This would remove the need to have that directory 
writable by the user the webserver is running as, it would remove the 
need to rename files, and it would reduce the number of places data 
needed to backup/recreate a weblog can be in.

I am thinking of implementing this. I would do it in a way that can run 
alongside the current code, switched by an option in the admin dialog.

Any thoughts?

-- 
Michael Leuchtenburg  |  http://slashhome.org/
cell: 413.433.0739
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/hackers_wordpress.org/attachments/20040919/9edfbf0a/attachment.htm


More information about the hackers mailing list