Giter Site home page Giter Site logo

michael-e / uniqueuploadfield Goto Github PK

View Code? Open in Web Editor NEW
21.0 5.0 13.0 33 KB

Extension for Symphony 2. Provides an upload field which allows multiple copies of a file to be uploaded to the same location.

Home Page: http://symphony-cms.com/download/extensions/view/20653/

License: Other

PHP 100.00%
symphony-cms-extension symphony-cms

uniqueuploadfield's Introduction

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

<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

uniqueuploadfield's People

Contributors

ahwayakchih avatar jensscherbl avatar kanduvisla avatar michael-e avatar nils-werner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

uniqueuploadfield's Issues

Foreign characters in file names disappear in datasource => cannot display images with foreign names

For example

/uploads/屏幕快照-2013-06-20-5.31.4-51c380fc0ecc3.png
/uploads/이수혁2-51cc9fa5c986f.png

will actually show up in the datasource as

/uploads/-2013-06-20-5.31.4-51c380fc0ecc3.png
/uploads/2-51cc9fa5c986f.png

However, in admin, the section with the files links to and displays the image just fine! (using image index preview). SBL fields in other sections however, show the incorrect 2-51cc9fa5c986f.png

Not sure if this is a uniqueupload problem or a Symphony problem in general

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.