Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7046445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:39:05+00:00 2026-05-28T02:39:05+00:00

I have a file download script that I have written, which reads files from

  • 0

I have a file download script that I have written, which reads files from below public_html and allows the user to download them after checking to see if the user is logged in and that the file is a valid file for them to download.

An issue I’ve recently come across is that on an iPad it just fails to do anything when the link is clicked.

Example download file code after all the checks have been done:

header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-Type: application/msword");
header("Content-Disposition: attachment; filename=\"file.doc\";" );
header("Content-Length: 50688");

readfile(SITE_PATH .'/files/file.doc');

This script has been tested and checked on PC, Mac and Linux machines in multiple browsers (FF, Opera, IE6-9, Chrome, Safari) and all seem to work fine, so it must be something that the iPad does differently.

I’d imagine it’s something to do with the iPad not actually having a file structure as such to download files to, but I’m not certain.

Has anyone come across this problem before? If so, is there a fix?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T02:39:06+00:00Added an answer on May 28, 2026 at 2:39 am

    iOS Safari does not support file download..

    Update: But if you are looking to open the .doc files on iPad then yes.. you can do that…

    use following –

    header("Pragma: public");
    header("Expires: 0");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Cache-Control: private",false);
    header("Content-Type: application/msword");
    
    
    readfile('file.doc');
    

    the only difference in your code and mine is I removed the header for attachment
    Just remove these header –

    header("Content-Disposition: attachment; filename=\"file.doc\";" );
    header("Content-Length: 50688");
    

    Actually you can check for client operating system if operating system is iOS then don’t add header for download like this –

    header("Pragma: public");
    header("Expires: 0");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Cache-Control: private",false);
    header("Content-Type: application/msword");
    
    if (!Operating_System_Is_IOS)
    {
    
         header("Content-Disposition: attachment; filename=\"file.doc\";" );
         header("Content-Length: 50688");
    
    }
    
    readfile(SITE_PATH .'/files/file.doc');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey everyone, I have written a script that downloads a zip file from a
I have this script that will let the user download the data from the
I have a script that download's files from a server, all works nice. But
I have a simple script that allows someone to download a movie file to
I am trying to download some files. I have written a php script that
I have a PHP script that needs to download several files from a remote
I have a php script that prompts the user to download a file: header(Content-Disposition:
I have a bash file that contains wget commands to download over 100,000 files
I have a website which allows secure (ssl) file uploads and download. The site
I have a microcontroller that must download a large file from a PC serial

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.