1
Я использую Zend FW 1
для загрузки файла. нужноСкачать файл в Zend 1 (PHP): Имя файла japanese
файла загрузка имеет имя файла: японский るファイルを選択.pdf
$this->path:
является путем к файлу. Пример: D:\るファイルを選択.pdf
Это мой код в PHP
public function send() {
if($this->checkPath()) {
// fileinfo extention enable
$type = mime_content_type($this->path);
if ($this->getRequest()->isSecure()) { // HTTPS sites - watch out for IE! KB812935 and KB316431.
header('Content-Description: File Transfer');
header('Cache-Control: max-age=10');
header('Expires: '. gmdate('D, d M Y H:i:s', 0) .' GMT');
header('Pragma: ');
} else { //normal http - prevent caching at all cost
header('Content-Description: File Transfer');
header('Cache-Control: private, must-revalidate, pre-check=0, post-check=0, max-age=0');
header('Expires: '. gmdate('D, d M Y H:i:s', 0) .' GMT');
header('Pragma: no-cache');
}
if ($this->isIE()) {
$name = rawurlencode($this->name);
} else {
$name = $this->s($this->name);
}
$name = urlencode($name);
$Disposition = "attachment;filename*=UTF-8''$name";
$this->getResponse()->setHeader('Content-Type', $type . ";charset=utf-8")
->setHeader('Content-Disposition', $Disposition, true)
->setHeader('Content-Transfer-Encoding', 'binary', true)
->setHeader('X-Sendfile', readfile($this->path), true)
->sendResponse();
unlink($this->path);
}
}
Но mime_content_type($this->path)
Retun:
mime_content_type (D: \ る フ ァ イ ル を 選 択 .pdf): не удалось открыть поток: Нет такого файл или каталог в ...
Я поставил UTF-8
в getResponse
Это работа тонкая 'mime_content_type()' для японского имени файла. Возможно, ваш путь неправильный или файл не существует. – newage
Я проверил файл, затем посмотрел путь к файлу, и файл существует –