PHP image upload method
I am developing a PHP website and I am having difficulty choosing the best method for storing uploade开发者_开发知识库d files.
At the moment I am considering storing the image as a BLOB in the MySQL database but I have also been told that storing the file name of the image would be enough.
There are advantages and disadvantages to both, personally i like to store the images outside of the db and reference the file using a varchar in the db.
If you want to go down the route of storing them as a blob, then this article is a nicely balanced one.
http://www.phpro.org/tutorials/Storing-Images-in-MySQL-with-PHP.html
In my opinion storing the file names only in database is fast and rich technique. you should save the files in any other directory. When you have to retrieve, your uploaded file you just need to compare it with stored name. If you are storing multiple types of files, so its always a good technique to store them in different directories. So storing the file name in database and file elsewhere is fast and good technique in my opinion
精彩评论