Anyone know how to solve ios/chrome download issue?

General discussions related to php

Moderators: egami, macek, gesf

Post Reply
helloimjah
New php-forum User
New php-forum User
Posts: 8
Joined: Sat Apr 18, 2020 3:55 pm

Tue Jan 19, 2021 1:29 pm

I have download php script which works on pc/all borwsers, andorid/chrome, ios/safari

problem is ios/chrome, instead of downloading file it just opens it, i did google this and found out many have this issue but it never states how they solved it

https://developer.apple.com/forums/thread/91868
https://www.reddit.com/r/ios/comments/7 ... on_ios_11/
https://stackoverflow.com/questions/418 ... gle-chrome
https://bugs.chromium.org/p/chromium/is ... ?id=574033
https://www.tutorialfor.com/questions-319971.htm


im using <a href='myscript.php download>Download</a> to download files

php

Code: Select all

header("Content-Description: File Transfer");
            header("Content-Type: application/octet-stream");
            if (strlen($ext)>0){
              header("Content-Disposition: attachment; filename=" . $name.'.'.$ext . "");
            }else{
              header("Content-Disposition: attachment; filename=" . $name."");
            }
            header('Content-Length: ' . filesize($file));
            readfile($file);
            exit();
i have already tried header("Content-Type: application/force-download"); and also setting content-type to image/jpg, but it still doesn't work, any ideas how i could make it work on ios/chrome?
Post Reply