The best option is to use .htaccessc mod_rewiteto rewrite calls to a specific directory in a PHP file. for example, any calls are /downloads/FILEHASH.jpgrewritten as/download.php?file=FILEHASH
Then it download.phpwill check whether the FILEHASHrow in the database matches and that the dl number was under x, if so, it would increase the dl number, set the response code as 200, content-type up image/jpegand run the image data (either saved in the file system or from the BLOB to DB).
dl x, 404 ( - , ), , . , , .
MVC, .
, , , mime upload , .