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.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|