Issues

ZF-11635: Zend_Filter_File_Rename does not keep the original filename if a target directory was provided

Issue Type: Bug Created: 2011-08-02T07:32:11.000+0000 Last Updated: 2012-09-18T17:56:20.000+0000 Status: Resolved Fix version(s): Reporter: Doron Gutman (gshockoman) Assignee: Thomas Weidner (thomas) Tags: - Zend_File_Transfer

  • Zend_Filter
  • zf-crteam-padraic
  • zf-crteam-priority

Related issues: Attachments:

Description

According to http://framework.zend.com/manual/en/…, when supplying a directory in the "source" argument (whether as an argument or inside an array), the original filename should be kept. However, it is not kept, and is saved with the following example's pattern: "phpX34d".

Calling $adapter->getFileName() inside the addition of the rename filter (in order to append the original file name to the directory) retrieves the entire path of where the file will be saved prior to the filtering (as the filter is not yet applied) which is something like "/tmp/originalFileName.jpg".

The above refers to a linux file system. Haven't checked this behavior under a Windows file system.

Comments

Posted by Thomas Weidner (thomas) on 2011-08-02T16:17:30.000+0000

Please provide an reproduceable example of your problem.

Note: It is a difference if you call methods prior receiving/validation/filtering or afterwards. The values you get can differ in such a case.

Posted by Thomas Weidner (thomas) on 2011-08-15T17:45:34.000+0000

Closing as incomplete since there is no response since several days

Feel free to reopen as soon as you give an example of your problem by code

Posted by Brian Morton (rokclimb15@gmail.com) on 2012-09-18T17:56:20.000+0000

I think I can shed some light on this. The reporter was probably led to believe this was occurring by a poorly formed exception message:

<pre class="highlight">
if (file_exists($file['target'])) {
    require_once 'Zend/Filter/Exception.php';
    throw new Zend_Filter_Exception(sprintf("File '%s' could not be renamed. It already exists.", $value));
}

This should probably sprintf the $file['target'] or at least include it additionally to make clear that /tmp/phpXXXX could not be renamed to $file['target']

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts