No such thing as a small change | |
PerlMonks |
Designing storage of uploaded filesby hacker (Priest) |
on Aug 20, 2002 at 02:41 UTC ( [id://191371]=perlquestion: print w/replies, xml ) | Need Help?? |
hacker has asked for the wisdom of the Perl Monks concerning the following question:
Hello again fellow monks...
One of the phases of the portal system I've been working on is designed to allow users to upload files (Palm documents, ebooks in Palm format, etc.) to allow other users to download and use them. I have the file upload portion of my script working at a very rudimentary level, and looks like this:
From here, I simply print the results of the file's size, type, title, and other form elements entered for diagnostics. This part works perfectly. Thanks to tye, ChemBoy, and ferrency's help and suggestions earlier today I will be using a newer construct using IPC::Open2 instead of my current system() call to retrieve the compression type stored inside the binary file itself (DOC or zlib).Note that I'm saving the file as an md5sum'd filename, to avoid collisions with duplicate documents being uploaded, etc. Here's the rub, I need to find a good workable design to allow thousands of users to upload files and content in this format to the server, which will sit in an approval queue, before being made "live" on the site for others to download. What is the best approach to doing this? Blob them in a MySQL database? Store on the filesystem? Both? And doing so, how do I track which filename belongs with which "actual" file, so when the file(s) are listed on a webpage for download, the title is something human readable, not 'e3206099b8ad73408762ab0ea5e8f1f2'. I've never done something like this before (tracking, storing persistant files/file data), so I'm a bit green. I'd eventually like the whole process of approval to be web-based, but for now I can deal with some manual intervention at the filesystem or database level. My concerns are:
Each file uploaded will have several bits of information associated with it, such as:
To that end, I've come up with the following basic schema for a table to hold this data:
Does this approach hold water? The only bits I think I'm missing, are what to do with the file(s) sent, how to access them, and how to make sure the user sees "human" content (filenames, titles), while the system sees "protected" (md5sum) content. Constructive ideas and architecture approaches are welcome. Thanks.
Back to
Seekers of Perl Wisdom
|
|