
September 26th, 2002, 09:29 PM
|
|
Junior Member
|
|
Join Date: Sep 2002
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Never BLOB
Absolutely. I got my hands on this project where the old programmer was storing everything from large, high-res images to quicktime panoramas (1/2 MB each) in the database. That was above and beyond the fact most of the website's content was database driven. Given a few dozen thousands page views with simultaneous user uploads and the database ground to a halt.
Since changing file names was a major faux pas on this project, I used mkdir to create new directories for each upload. Then, used move_uploaded_file to upload the file while at the same time copying the dynamically created path and storing both it and the filename in the database.
For security, I used a combination of placing the uploads directory outside the main httpdocs directory (so visitors couldn't directly source the files) and Apache authentication so only the server could access the directory.
When I want to call an image in a webpage, I just piece together the path stored in the database. The size of the db fell by about 80% and everything is working much, much faster.
Just because you can BLOB doesn't mean you should
|