/** * Retrieve the original filename of the file to be transferred. * * Check for the 'name' attribute first, otherwise extract the basename() * from the given file path. * * @param array $info File info array. * @return string */ protected function _getOriginalFilename($info) { if (!($original = parent::_getOriginalFilename($info))) { $original = basename($this->_getFileSource($info)); } return $original; }
/** * Return the original filename. * * @param array $fileInfo * @return string */ protected function _getOriginalFilename($fileInfo) { if (!($original = parent::_getOriginalFilename($fileInfo))) { $url = $fileInfo['source']; //gets rid of the query string, if it exists if ($index = strpos($url, '?')) { $url = substr($url, 0, $index); } // Since the original file is from a URL, it is necessary to // decode the URL in case it has been encoded. $original = urldecode($url); } return $original; }