Daniel0 Posted January 8, 2007 Share Posted January 8, 2007 I found that longblobs only allow 2MB which isn't quite enough for me. Is there any way to store larger files or should I store them as files with the filename in the database? How should I prevent users from downloading the files if placing them outside document root is not an option? .htaccess? Quote Link to comment https://forums.phpfreaks.com/topic/33333-storing-files-in-databases/ Share on other sites More sharing options...
corbin Posted January 9, 2007 Share Posted January 9, 2007 [code=php:0]deny from all[/code]in an .htaccess file will deny everyone access.I would do that and then create an attachment.php file that included the file and output the correct headers for the file ext. And I would just store the file location in the DB and then use attachment.php where you had fileid=X and then it would pull the location from the DB where the ID was the fileid thing. Quote Link to comment https://forums.phpfreaks.com/topic/33333-storing-files-in-databases/#findComment-156331 Share on other sites More sharing options...
Daniel0 Posted January 9, 2007 Author Share Posted January 9, 2007 Yeah, I suppose I'll have to do so. Quote Link to comment https://forums.phpfreaks.com/topic/33333-storing-files-in-databases/#findComment-156502 Share on other sites More sharing options...
neylitalo Posted January 13, 2007 Share Posted January 13, 2007 I suggest never storing files in the database. It's relatively inefficient, and will certainly make your life difficult if you ever want to do any server-side stuff with it. I always recommend storing the file in the filesystem and just storing the path to that file in the database. Quote Link to comment https://forums.phpfreaks.com/topic/33333-storing-files-in-databases/#findComment-159810 Share on other sites More sharing options...
worldworld Posted February 11, 2007 Share Posted February 11, 2007 I think you must store files in .txt format and give the path in database as your page loading time reduces drastically and server load also reduces much... Quote Link to comment https://forums.phpfreaks.com/topic/33333-storing-files-in-databases/#findComment-181745 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.