Jump to content

Problem with product attachment download


darkmanx07

Recommended Posts

Hello,

 

I'm having some problems with product attachment on IOS, i can't open or download pdf in IOS with safari (didn't checked for other browser), for android or desktop browser it's working with no issue.

I noticed that if i deactivate SSL then the link will open on iphone, but that's not a solution.

Link it's like: index.php?controller=attachment&id_attachment=xxx.

I have changed AttachmentController.php so now pdf will open in a new tab instead of download but w/o any result on iphone.  

I tried few .htaccess rules but w/o succes for example:

<FilesMatch "\.(pdf|csv|xls)">
  Header set Content-Disposition attachment
</FilesMatch>

Prestashop version is 1.6.1.7

Any help or tips will be greatly appreciated.

I'm using an IOS emulator but i have tried a real phone and i get the same results, just that i don't own one.

Thanks. 

 

123.png

Edited by darkmanx07 (see edit history)
Link to comment
Share on other sites

  • 6 years later...

On iOS Safari, this is usually a response header issue, not the attachment itself.

First check that the download response is sending proper headers (especially Content-Type and Content-Disposition: attachment) and that nothing is output before the headers (no BOM, no extra spaces, no debug output). Even a small warning or whitespace can break the download of the iOS Emulator on Safari.

Also, make sure the controller is not returning the file through an iframe or with any HTML around it. iOS Safari is picky and often shows a blank page if it thinks it is “rendering” something instead of downloading it.

If you are using any override/module that touches the attachment controller, temporarily disable it and test with the default controller behavior. After that, clear PrestaShop cache and browser cache and retest on a real device.

If it still fails, it’s worth checking server rules (security modules, caching, compression) that may strip or alter download headers for that endpoint.

Edited by Caroline Harper (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...