Storing pictures in MySQL - Smart?
I know this is an age old question, and usually you can't get a simple answer.
However, I'm in the situation where I might need 20gb of storage for pictures on a collaborative web app I'm creating using ASP.NET MVC, but my web host doesn't give me more than 4gb of storage. However - I have unlimited space on my MySQL DB, so I'm seriously considering u开发者_如何学Gosing the longblob or something in the MySQL DB as storage - can anyone give me a couple of reasons why not go this way? The alternative would be a very expensive host, or a possibly equally expensive solution with cloud storage (I'm thinking Amazon S3 or something).
Thanks!
Not smart. Because unless your webhost is very dumb, they will notice and tell you to stop being silly.
"Unlimited" very rarely actually means "unlimited".
This is not much lines of code, try and check what solution is better for you problem.
I think if you have unlimited DB Storage and you doesn't matter on bandwidth between database server and run time environment then probably this solution might be better for you.
It's not really an age old question with no simple answer - it's simply inappropriate to store image data in a database.
Using it as a workaround for limited disk space is simply going to cause other issues, such as the fact that it'll be a lot slower to load and it's likely the hosting company will pull the plug once they realise what's going on. (If they're the kind of company that limits you to 4GB of local disk space, then I also have to wonder whether their MySQL set up will cope with serving up image content.)
精彩评论