1.11.0releasedUnique Upload Field
Create unique filenames automatically.
Clone URLhttps://github.com/michael-e/uniqueuploadfield.git
Add as a submodulegit submodule add https://github.com/michael-e/uniqueuploadfield.git extensions/uniqueuploadfield --recursive
Compatibility
2.x.x | 2.1.x | 2.2.x | 2.3.x | 2.4.x | 2.5.x | 2.6.x | 2.7.0 | 2.7.1 | 2.7.2 | 2.7.3 | 2.7.4 | 2.7.5 | 2.7.6 | 2.7.7 | 2.7.8 | 2.7.9 | 2.7.10 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
No | 1.6 | 1.6 | 1.11.0 | 1.11.0 | 1.11.0 | 1.11.0 | 1.11.0 | 1.11.0 | 1.11.0 | 1.11.0 | 1.11.0 | 1.11.0 | 1.11.0 | 1.11.0 | 1.11.0 | 1.11.0 | 1.11.0 |
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
Upload the 'uniqueuploadfield' folder in this archive to your Symphony 'extensions' folder.
Enable it by selecting the "Field: Unique File Upload", choose Enable from the with-selected menu, then click Apply.
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
<IfModule mod_setenvif.c>
<IfModule mod_rewrite.c>
<IfModule mod_headers.c>
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
</IfModule>
</IfModule>
</IfModule>
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
Version history
Symphony 2.3.x to 2.x.x
- PHP7 compatibility
Symphony 2.3.x to 2.x.x
- Marked as compatible with Symphony 2.x.x
Requires Symphony 2.3.x
- Minor fixes; code formatting
Requires Symphony 2.3.x
- Fixed 2.3.3 update procedure
Requires Symphony 2.3.x
- Implemented updater for Symphony 2.3.3
Requires Symphony 2.3.x
- Symphony 2.3.x compatibilty
Symphony 2.0.6 to 2.2.x
- Added 'clean filename' functionality; final release for Symphony 2.2.x
Symphony 2.0.6 to 2.2.x
- Added extension.meta.xml file
Symphony 2.0.6 to 2.2.x
- Explicitly set CHARSET and COLLATION when creating the table.
Requires Symphony 2.0.6
- Fix for REGEXP so it does not break paths stored in
$filename
.
Requires Symphony 2.0.6
- Replaced date() by uniqid(), making filenames even more unique.
Requires Symphony 2.0.6
- Symphony 2.2 compatibility
Requires Symphony 2.0.6
- MySQL5.5 compatibility
Requires Symphony 2.0.6
- Added updater function to modify entry tables (as required by Symphony > 2.0.8RC3)
Requires Symphony 2.0.6
- Added git control