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 7989009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:37:33+00:00 2026-06-04T12:37:33+00:00

I have a form that uses a hidden iframe to submit a file to

  • 0

I have a form that uses a hidden iframe to submit a file to a script that changes the file and then returns the changed file. I found that I don’t actually have to save the file anywhere if I just do something along the lines of echo file_get_contents(tmp);, where tmp is the path of the file uploaded to the apache tmp directory.

The script also does: header("Content-type: application/octet-stream") so that when the iframe loads, the user is prompted for download. I would like to know, on the client side, if everything went alright with the server. It’s not an XMLHttpRequest, so I can’t check the headers, and the only thing returned is the file itself.

Is there some way to return some json before streaming the file? Or, is there a way to check the headers of an iframe?

Currently, I’ve been setting a cookie with the server and checking every half a second with javascript to see if the cookie was set. I would prefer a less hacky solution than this though.

  • 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-06-04T12:37:34+00:00Added an answer on June 4, 2026 at 12:37 pm

    If you stream JSON before the file, the MIME header will be invalid and the browser will not be able to download the file.

    In terms of checking “if everything went alright with the server”, why wouldn’t you be determining this on the server, rather than going round-trip to the client and back again? Allowing it to error-out on the client smells of bad design.

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

Sidebar

Related Questions

I have a form that uses google docs and when you submit it will
I have a form that uses jQuery to submit an ajax post and it
I have a form that uses Richtexteditor of Flex3 to write in their reply.
I have a form that uses jquery to generate rows of input fields these
I have a Django form that uses a different number of fields based on
I have a WPF form that uses ClientLogin to log a user into their
I have a Django form that uses an integer field to lookup a model
I have a web form that uses if statements to create a string of
I currently have a PHP form that uses AJAX to connect to MySQL and
I have a contact us form that uses Ajax (i.e. relies on asynchronous requests).

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.