chop Posted March 15, 2013 Share Posted March 15, 2013 There doesn't seem to be unanimous agreement with this so I'm throwing it out to you, gang. I'm designing a site where people can download pdf and ePub files. Should the files themselves be kept in a database or in a folder? I don't like the idea of putting a folder in the public html but perhaps it could go in the directory above that, where I keep the mysql_connect.php. Would that be safe? These files need to be fairly safe from the hackers as they are being sold. Well...? Link to comment Share on other sites More sharing options...
HartleySan Posted March 16, 2013 Share Posted March 16, 2013 There's an entire chapter/section in the book that talks about using a proxy script to access files stored outside the web directory. I personally have never felt the need to store files directly in a DB. Simply storing the path to the actual file outside the web root seems more than sufficient. Link to comment Share on other sites More sharing options...
chop Posted March 16, 2013 Author Share Posted March 16, 2013 Thanks for your opinion HS. There seems to be quite a debate about it with some good arguments on each side. I was just wandering if anyone here has perhaps tried putting images or pdfs in a db table and how it worked for them. I'm not sure what the file sizes will be or many of them ultimately there will be, but that might be a determining factor. thanks Link to comment Share on other sites More sharing options...
HartleySan Posted March 16, 2013 Share Posted March 16, 2013 After checking out SO, it would seem that most people find storing files in the file system (as opposed to the DB) to be best. The general opinion seems to be that expanding a file system by adding additional web servers is easy and cost-effective, whereas scaling a DB is the hardest possible route to take. On the other hand, storing files in the DB seems to make backups and the like much easier. If you have a fixed-size app and you know how many users you will ever have, then maybe you can store the files in the DB and get away with it, but other than that, file-system storage seems to be the way to go. Here's the best (long) discussion I found on the matter (and you may have already seen the same thing): http://stackoverflow.com/questions/3748/storing-images-in-db-yea-or-nay Link to comment Share on other sites More sharing options...
chop Posted March 16, 2013 Author Share Posted March 16, 2013 Yes, that's a pretty good summary of what I've found on various inquiries. Because this project involves continuous expansion, I'm probably going to go with the saving the files outside the db and referencing them by file name stored in the db. How safe would the files be in the folder above the "public_html"? It's not like these are CIA or NSC files but some are valuable commodities within the business world and a theft wouldn't reflect well on me though nobody will be suffer a great deal if something like that happened. Link to comment Share on other sites More sharing options...
HartleySan Posted March 16, 2013 Share Posted March 16, 2013 My friend Matt who used to come around these forums occasionally recently did a ton of research on this very topic, and pretty much found the best way to handle this, so lemme talk with him first, and then I'll get back to you. Link to comment Share on other sites More sharing options...
chop Posted March 20, 2013 Author Share Posted March 20, 2013 I appreciate that H.S. I'm in no rush but would like to hear your friend's answer. Link to comment Share on other sites More sharing options...
ericp Posted April 15, 2013 Share Posted April 15, 2013 There's an entire chapter/section in the book that talks about using a proxy script to access files stored outside the web directory. I personally have never felt the need to store files directly in a DB. Simply storing the path to the actual file outside the web root seems more than sufficient. But we can not do this @ godaddy.com Do you think so? Ericp Link to comment Share on other sites More sharing options...
Larry Posted April 15, 2013 Share Posted April 15, 2013 It wouldn't surprise me either way, but you should stop using GoDaddy hosting ASAP. Link to comment Share on other sites More sharing options...
HartleySan Posted April 15, 2013 Share Posted April 15, 2013 Agreed. Don't use GoDaddy, HostGator and the like for hosting. Your best bet is to go on word of mouth from people who have a lot of experience dealing with web hosting companies (e.g., Larry), as well as do web searches for good web hosting companies that have the features you want. Link to comment Share on other sites More sharing options...
Jonathon Posted April 16, 2013 Share Posted April 16, 2013 I've never had any problems with HostGator, their service has been excellent for me, I can access things outside my webroot too, customer service on live chat is great, there isn't anything that I've needed that hasn't been available to me (so far). Just my experience. Slightly off topic I know. GoDaddy I know are limited in what they offer however a friend used them. Link to comment Share on other sites More sharing options...
Recommended Posts