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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:16:41+00:00 2026-05-28T17:16:41+00:00

I have an iframe which does some server-side work and displays an image. We

  • 0

I have an iframe which does some server-side work and displays an image. We use the iframe in order to show image dynamically. The user hits upload image, we show a spinner, and reload the iframe with the new image. My goal is to avoid the confirm form resubmission page that displays if a user gets to the page via the ‘back’ button.

Essentially, the page which is the src of the iframe is a php file which checks against three conditions:

1) Was a variable named redirect set? If so, ‘urldecode()’ it, and use it as the img src.

2) Was a file uploaded? If so save it to the db, and redirect to this page with the image path as a GET variable

header('Location : mypage?redirect=path%2Fto%2Fimg.jpg'); 
die('upload');

3) Nothing was uploaded? Grab what we have from the db, then redirect to this page with the path as a GET variable

header('Location : mypage?redirect=path%2Fto%2Fimg.jpg'); 
die('default'); 

And what we have in the parent page is

<iframe id='myframe' src='mypage.php'>

Problem is, we never get a redirect. The page does die though, so instead of a profile pic, we see a white square with either the string upload or default from the die() call.

When using header() inside an iframe, does it behave as it does normally? I would like it to redirect the contents of the iframe.

Thanks for your time.

  • 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-28T17:16:42+00:00Added an answer on May 28, 2026 at 5:16 pm

    I just replicated this in my testing environment. Your header is incorrect, there shouldn’t be a space between Location and :

    Works

    header('Location: mypage?redirect=path%2Fto%2Fimg.jpg'); 
    die('default'); 
    

    Doesn’t work

    header('Location : mypage?redirect=path%2Fto%2Fimg.jpg'); 
    die('default'); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page which work like a navigation and a iframe in this
I want to make an iFrame slideshow, which will show some websites in an
I have created an iframe which contains the label, powered by MyWebsite.site The iframe
I have an embedded iframe form which takes a file from a type=file form
I have a question on javascript window management. My application opens an iframe which
I have a page which has an Iframe. In that Iframe, there are six
I have an HTML page (say welcome.html) which contains an iframe to a page
I have a page P1 loading from site S1 which contains an iframe. That
So I have the following code which is doing a setInterval until the iframe
i am using php 5.2.8 i have index.html, which loads LOAD.PHP from IFRAME. iframe

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.