Repeat after me:
- I will not store files inside of the database.
- I will not store files inside of the database.
- I will not store files inside of the database.
- I will not store files inside of the database.
- I will not store files inside of the database.
- I will not store files inside of the database.
- I will not store files inside of the database.
- I will not store files inside of the database.
Storing files inside of the database is just a Bad Idea. You are much better off doing something like the following:
- Insert a new record into the database (filename, size, source, date, etc).
- Get the ID of the new record.
- Take the md5 hash signature of the ID + some secret code.
- Your hash is something like 0123456789abcdef0123456789abcdef
- Update the database record to show "hash = '0123456789abcdef0123456789abcdef'"
- Make folder /var/media/01/23/45
- Write file contents to /var/media/01/23/45/0123456789abcdef0123456789abcdef
NOTE: /var/media/ could be a local volume or a remote-mounted SAN. You choose.
Now, you can partition the files across multiple servers. You can store the files on a SAN and have (many) dummy file servers in front of it.
This is (basically) how wikimedia does it. And just look at how many files they have. Storing the files inside of the database is just Not How It's Done.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.