UPDATED TO 1.1
FileName TV no longer required. Uses document’s "alias" instead.
If FURLs are not enabled, this snippet will grab the alias from the "site_content" table using $_REQUEST[’id’]
Parameter &filename replaced with &id. For getting the number of downloads, simply specify document’s id in this parameter.
For example: [!FileDownloadPE? &action=`count` &id=`36`!]
Auto-detecting mime type just won’t work yet without a depreciated function "mime_content_type()" which is not installed on either of my servers, or the PECL "finfo" extension. Neither are reliably available on servers. I am looking forward to PHP 6.
Quote from: therebechips at Jun 17, 2008, 09:14 AM
Finally, I had been planning to rewrite FileDetails to provide the option of secure file storage in the database itself (the only way to get true security I reckon, since /assets/files/[filename] is going to be guessable) - but since you already have that extra table, would you consider doing this?
I don’t have anything against storage in the database, but I totally
disagree that the file path is going to be guessable.
First of all, there is no reason to set the alias to the name of the file. Secondly, If you use the MODx resource browser, you are slightly limited to /assets/files/, but you can use any number or name of sub folders. Upload your file to "/assets/downloads/current/projects/2008/" through the MODx resources browser and it is cleanly organized AND
They can guess all day. If you want, obscure the folders a bit. Third, You are not limited to using the MODx Resource browser. Instead, FTP your files to "/home/your-username/public_html/private_files/" and put "private_files/myfile.zip" in the File TV.
Dr. Scotty Delicious, DFPA.