Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Zend\Filter\File\RenameUpload - Added possibility to maintain original file extension #3990

Conversation

robertmarsal
Copy link
Contributor

When using the Zend\Filter\File\RenameUpload filter on a file upload (that can have any extension) the extension is lost if the target does not specify it.

Added a new option (use_upload_extension) that, when specified, maintains the original extension.

Example :

If the user uploads a .png image test.png :

<?php
$filter = new RenameUpload(array(
    'target'  => pictures,
    'use_upload_extension'  => true,
    'randomize'  => true,
 ));

The filter will return something like pictures_ad321e2r5ty5s.png

Works with randomize on and off.

@ghost ghost assigned weierophinney Mar 8, 2013
weierophinney added a commit that referenced this pull request Mar 12, 2013
…ain-extension

Zend\Filter\File\RenameUpload - Added possibility to maintain original file extension
weierophinney added a commit that referenced this pull request Mar 12, 2013
- elseif clause
weierophinney added a commit that referenced this pull request Mar 12, 2013
@weierophinney
Copy link
Member

As this adds to the public API, merged to develop for release with 2.2.0.

weierophinney added a commit to zendframework/zend-filter that referenced this pull request May 15, 2015
…feature-rename-upload-maintain-extension

Zend\Filter\File\RenameUpload - Added possibility to maintain original file extension
weierophinney added a commit to zendframework/zend-filter that referenced this pull request May 15, 2015
weierophinney added a commit to zendframework/zend-filter that referenced this pull request May 15, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants