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


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);



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

Changed type from bug to improvement.

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.

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.

Behaviour improved with r13712