I am storing all my files like "8asd98asd9as7d98asd9.file" and rerieve the "real" filename from a mysql-database: id (INT) AI PK, pathOnServer TEXT NOT NULL, realFilename VARCHAR(200) NOT NULL.
I need a script which allows me to access the files like "www.website.com/getFile?id=2" which downloads the file and renames it to "realFilename".
How can this be done?
I do believe this code will do a trick you look for
You could also add the header with filesize. Hope it will help you.
You can use the
Content-Disposition
HTTP Header to tell the Browser the name of your file and then use readfile to load and echo said file.