ZF-5290: Zend_Form_Element_File getFileName should have an additional optional parameter to truncate the path

Issue Type: Improvement Created: 2008-12-16T19:28:11.000+0000 Last Updated: 2009-01-20T10:49:45.000+0000 Status: Resolved Fix version(s): - 1.8.0 (30/Apr/09)

Reporter: Steven Rosato (ratius) Assignee: Thomas Weidner (thomas) Tags: - Zend_Form

Related issues: Attachments:


The Zend_Form_Element_File getFileName($value = null) function should have an additional optional parameter which would be $path = null just like in the Zend_File_Transfer_Abstract class where the getFileName accepts a boolean (on the second parameter) which will truncate the full path if true is passed.

If value is empty, the adapter's getFileName is called and therefore Zend_Form_Element_File getFileName function should be behaving the same as the one in the abstract class.

The suggested correction would then be:

public function getFileName($value = null, $path = null) { if (empty($value)) { $value = $this->getName(); }

    return $this->getTransferAdapter()->getFileName($value, $path);



Posted by Thomas Weidner (thomas) on 2008-12-17T00:05:28.000+0000

And why should this be a bug ? What you describes looks for me like a feature request and not like a bug.

Posted by Thomas Weidner (thomas) on 2008-12-17T00:06:30.000+0000

Changed type from bug to improvement.

Posted by Thomas Weidner (thomas) on 2008-12-17T00:13:18.000+0000

According to manual and API doc the method getValue returns ONLY the filename without path. To get the complete path you must use getFileName().

So eighter use getValue or call basename on the returned information.

Posted by Steven Rosato (ratius) on 2008-12-17T11:10:30.000+0000

My bad about choosing the wrong type.

getValue() works well but I thought that since the getFileName() function uses the transfer adapter's getFileName() function, it should behave in a similar way.

Posted by Thomas Weidner (thomas) on 2009-01-20T10:49:45.000+0000

Behaviour improved with r13712

Have you found an issue?

See the Overview section for more details.


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

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