You could do a varchar(200) to store file location instead and have the actual file stored in a directory. But if the link is obvious, anyone can download the file. In that case you may want to chec out htpasswd.
Direct File access is defintely faster than db storage, but if you dont want direct links, resume downloads etc and want user-only access to these files, db storage is safer.
ok..i'm dealing with the 20MB up to 400MB file size(.gzip file format). i've tried to put that such big file to MySQL database, but i got an error, because it exceeded the maximum allowable packet(set to 8MB only).
i want the user can download or view that file from web. do you have any idea how to store this big data? i've been stuck with this problem almost 3 weeks.
The max_allowed_packet is a mysql server setting. It limits the amount that can be sent to or received from the server in one transfer. I believe this is per command, so it would apply to the amount of data returned in one row of a SELECT or the amount that was contained in an UPDATE or INSERT command.
The default value is 1MB. If you have shared hosting with a setting of 8MB, it is unlikely you will get the hosting company to change this setting.
Edit: Mysql will request memory for a buffer up to this limit. If this is your mysql server, make sure the computer has enough RAM memory and like I said above, a hosting company will probably not increase this much beyond what it is now. Storing such large files in a database is not efficient.