简体   繁体   中英

File Download Gives Error “File if broken” on IOS (works on PC)

I have a PHP script which is downloading file after it is created. Everything is working correctly when using PC but when I want to load same script on my iPad for example I can't download it. I'm getting error that file is broken.

What could be the problem?

My headers in PHP file:

header('Content-Description: File Transfer'); 
header("Content-type: application/ms-word");
header("Content-Disposition: attachment;Filename=offer.doc");

I have a PHP script which is downloading file after it is created.

My bet is you're using HTML to create the file, and giving it a .doc extension to make it look like a Word document.

While this is totally okay and supported by all versions of Word AFAIK, a 3rd party viewer program like on an iPad may be more strict. A HTML based file is technically not a Word document, and the viewer may not be equipped to parse it accordingly.

You may need to resort to generating a real .doc file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM