I have recently experienced an issue with code that was working fine but then started to include quotes around the filename.
We have recently upgraded our server to PHP 7.2 and think this might be the cause of the change but was wanting to see if anyone might know for sure.
We are running Laravel 5.5 app on Ubuntu server with PHP 7.2 and has been observed to work and no longer work in Chrome (the main browser we use)
The following code was working fine for months:
$file = Storage::disk('s3')->get($location);
$headers = [
'Content-Type' => 'xml',
'Content-Description' => 'File Transfer',
'Content-Disposition' => "attachment; filename='" . $realName . "'",
'filename'=> $realName
];
return response($file, 200, $headers);
This would download example.xml fine
However it recently started to download 'example.xml' requiring me to remove the quotes to this:
$file = Storage::disk('s3')->get($location);
$headers = [
'Content-Type' => 'xml',
'Content-Description' => 'File Transfer',
'Content-Disposition' => 'attachment; filename=' . $realName,
'filename'=> $realName
];
return response($file, 200, $headers);
I have seen this problem with multiple file types and so is not file type related.
I am just seeking to discover the cause of this problem especially since the inclusion of the quotes is from what I understand is needed for backwards browser compatibility.
** Update **
I have found this related question but it does not answer the question that I am after:
PDF downloads surrounded by single quotes?
** Update 2 **
I have tested the signle quotes with multiple browsers and it does not work with Chrome and Firefox but does work with Internet Explorer & Edge at current versions.