MySQL Database Question

Could the database be used as a private file retrieval account?

Tell me if this sounds possible.

Server files are stored as Blob data type on a Mysql Database or (accessible with a link to the file from the server), in one individual table row.

This is called the password protected portion of the site.

Customers are sent an email with their new password and user-name for this account.
They can then download their files and even manage future files that are placed here.

Understand what I’m trying to do, is their an alternative?


It can, but there are alternatives and I think you shouldn’t use the database as a file store. That’s what the filesystem is for.

Here’s how I would do it:

  • Put the files inside a directory that is outside of your webserver’s document root.
  • Store the location of each files in a rows in the database.
  • Use a script to serve the file to an authenticated user. (something like 'if ($user_has_access) {file_get_contents($file_location); die();})

Upload a File and write to MySQL

I see, so the location of users uploads would be stored in a server folder, and the download-able content a similar
folder, which is made accessible after I either automatically or manually generate an authentication username and password for the MySQL database for downloading from the servers folder.

Since developing and writing code is beyond my current skills, I’ll probably
resort to using an application for this. Thanks for explaining it Joazito.