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

  • Home
  • SEARCH
  • 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 3222726
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:01:28+00:00 2026-05-17T16:01:28+00:00

I know how to display output to a web browser (obviously) and I also

  • 0

I know how to display output to a web browser (obviously) and I also know how to push a file for the client to download by setting the Content-Disposition and Content-Type headers and then pushing the file data. But I want to do both, similar to how many download pages work (“your file download will begin momentarily”).

What technique is used to accomplish that? I was thinking about using a META HTTP refresh, but here’s the thing… The web page is actually doing some fairly complex processing and I want to display the results of the processing to the user and push the results in file form to the user but only perform the processing once. I would like to avoid the HTTP refresh if possible. Is there any way to accomplish both of these with a single page request? Or am I going to have to write the file to the server and then serve it up on the second page request from the HTTP Refresh request?

  • 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-17T16:01:28+00:00Added an answer on May 17, 2026 at 4:01 pm

    Use an iframe in your output that will have a link to the file you want to download.

    Output sample:

    <div>Foo</div>
    <iframe width="0px" height="0px" src="path/to/file"></iframe>
    

    You cannot say “this part if for display and that one is for download” with the HTTP protocol.

    However, you can “cache” the file in a temp directory, one that is inaccessible from the public view (outside the document root) and then output that document content through PHP (ex: file_get_contents or something). That temp folder can then be cleaned by an API that could simply scan that folder and delete any file older than a certain time (see filemtime())

    This cleanup can be done every time a new file is created, thus keeping the size of the folder at a reasonable value.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know how to do a regular php mysql search and display the results.
I know Microsoft has made efforts in the direction of semantic and cross-browser compliant
I know this might be a no-brainer, but please read on. I also know
I know, I would have thought the answer was obviously no as well, but
Does anyone know of a Calendar scheduler control that would display a whole month
Yes, I know, the old question of the best web framework ... but let
I use carp free 3.6.4 to display content from some wordpress rss feeds onto
I would like to display the differences between versions of the same content. Initially
Hy! I would like display my log system output on a listbox, with custom
I need to develop a file indexing application in python and wanted to know

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.