Allow accent in Filename
Protected function allow overwrite without full copy paste Even if you have to rewrite the factory method anyway ... first filename will be a fallback in ASCII for browser not supporting second filename with asterisk
This commit is contained in:
parent
ab973cab34
commit
56266a9c94
@ -125,7 +125,7 @@ abstract class WriterAbstract implements WriterInterface
|
|||||||
|
|
||||||
// Set headers
|
// Set headers
|
||||||
$this->globalFunctionsHelper->header('Content-Type: ' . static::$headerContentType);
|
$this->globalFunctionsHelper->header('Content-Type: ' . static::$headerContentType);
|
||||||
$this->globalFunctionsHelper->header('Content-Disposition: attachment; filename="' . $this->outputFilePath . '"');
|
$this->globalFunctionsHelper->header($this->getContentDispositionHeader());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When forcing the download of a file over SSL,IE8 and lower browsers fail
|
* When forcing the download of a file over SSL,IE8 and lower browsers fail
|
||||||
@ -143,6 +143,16 @@ abstract class WriterAbstract implements WriterInterface
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition
|
||||||
|
* @link https://tools.ietf.org/html/rfc5987
|
||||||
|
* @link https://tools.ietf.org/html/rfc2231#section-4
|
||||||
|
*/
|
||||||
|
protected function getContentDispositionHeader(): string
|
||||||
|
{
|
||||||
|
return 'Content-Disposition: attachment; filename="' . iconv('UTF-8', 'ASCII//IGNORE', $this->outputFilePath) . '"; filename*=utf-8\'\'' . rawurlencode($this->outputFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the pointer to the file/stream to write to is available.
|
* Checks if the pointer to the file/stream to write to is available.
|
||||||
* Will throw an exception if not available.
|
* Will throw an exception if not available.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user