Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/michael-e/uniqueuploadfield
Extension for Symphony 2. Provides an upload field which allows multiple copies of a file to be uploaded to the same location.
https://github.com/michael-e/uniqueuploadfield
symphony-cms symphony-cms-extension
Last synced: 21 days ago
JSON representation
Extension for Symphony 2. Provides an upload field which allows multiple copies of a file to be uploaded to the same location.
- Host: GitHub
- URL: https://github.com/michael-e/uniqueuploadfield
- Owner: michael-e
- License: other
- Created: 2009-05-06T10:58:53.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2021-01-30T19:21:51.000Z (almost 4 years ago)
- Last Synced: 2024-10-12T06:19:35.038Z (about 1 month ago)
- Topics: symphony-cms, symphony-cms-extension
- Language: PHP
- Homepage: http://symphony-cms.com/download/extensions/view/20653/
- Size: 32.2 KB
- Stars: 21
- Watchers: 5
- Forks: 13
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Field: Unique File Upload
This extension, just like the Hashed Upload Field extension by Rowan Lewis, provides an upload field which allows multiple copies of a file to be uploaded to the same location. It will retain the filename and append a unique ID to it.
The extension uses PHP’s preg_replace function and will crop the filename (i.e. w/o file extension) to a fixed length.
## Origin
This extension is a variation of the 'Hashed Upload Field' extension by Rowan Lewis.
## Installation
1. Upload the 'uniqueuploadfield' folder in this archive to your Symphony 'extensions' folder.
2. Enable it by selecting the "Field: Unique File Upload", choose Enable from the with-selected menu, then click Apply.
3. You can now add the "Unique File Upload" field to your sections.
## The Clean Filename
From version 1.6, this extension provides an additional "clean filename" in the XML output (for display purposes).
### Downloading Files with the Clean Filename
If you want to download files named with a clean filename, put the following .htaccess in your upload folder. If the relevant Apache modules are available, your browser will be asked to download the file under its original name.
Options -Indexes
SetEnvIf Request_URI "([^\/]*)(\.[^\.]+)$" FILENAME=$1$2
SetEnvIf Request_URI "([^\/]*)(\-[a-f0-9]{13})(\.[^\.]+)$" FILENAME=$1$3
Header set "Content-disposition" "attachment; filename=%{FILENAME}e"
UnsetEnv FILENAME
That way the unique filename can be entirely hidden from users:
* Alice uploads `report.pdf`
* Symphony renames it to `report-4415297e3af8c.pdf`
* Bob still ends up with `report.pdf` on his machine after downloading the file