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

The Archive Base Latest Questions

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

I am using the iframe technique to upload a file contained in a form.

  • 0

I am using the iframe technique to upload a file contained in a form.

It’s working perfectly, I even send myself an email with the file. The only problem is that I want to get infos from the iframe, such as file size. However, I can’t update the iframe’s content from the php script. I tried putting ‘echos’ on the line before it sends the email (so it actually gets there), but as soon as the iframe’s jQuery’s “load” function fires, there is nothing in the iframe. Even tried “Inspect element” and “view source”, all empty.

Am I missing something obvious? I can’t find anyone with the same problem on SO or google.

FORM:

<form id="submitResumeForm" method="post" enctype="multipart/form-data" action="career/sendResume" target="submitTarget">
<!-- input fields, etc -->
<input type="button" onClick="submitForm()" value="<?=lang('submit')?>" />
</form>
<iframe id="submitTarget" name="submitTarget" src="" style="position:absolute;top:-1000px;left:-1000px;width:0;height:0;border:0px solid #fff;"></iframe>

JAVASCRIPT:

function submitForm()
{
    $('#submitResumeForm').attr('target', 'submitTarget');
    // ... verifications ...
    $('#submitTarget').load(function()
    {
        console.log( $(this).html() ); // Content is: "content before"
        console.log( $(this).contents() ); //Garbage
    });
    // Line Below puts content in the iframe, and that content is still there after
    // the php is executed, so iframe is NEVER updated
    $('#submitTarget').html('content before');

    $("#submitResumeForm").submit();
}

PHP CONTROLLER:

function sendResume()
{
    echo 'ASDFASDFASDFASDF';
    $this->load->library('email');
    $this->email->clear();      
    $this->email->to($this->input->post('email'));
    // ... other fields, attach file (working perfectly)
    $this->email->send();
}
  • 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-28T14:40:18+00:00Added an answer on May 28, 2026 at 2:40 pm

    Here’s the solution:
    The line

    console.log( $('#submitTarget').html() ); // Display iframe's content
    

    Is NOT updated in the DOM for some reason I don’t know, you have to use this if this ever happens to you:

    console.log( $('#submitTarget').contents().find('body').html() );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I working on adding file uploading to my web application. I'm using an iframe
SOLUTION Refer to my answer below: issues with form/iframe based file upload in Opera
I'm trying to create file upload using iframe(ajax effect) but I need to know
I am using Thickbox 3.1 for a login form, using the iframe version. I
I want to implement file upload in RESTful way using openrasta but not able
I'm uploading some files in the same page using the Iframe technique. I'm extracting
hi i am developing a facebook application using iframe.Invite friends is working fine now
I am developing a WYSIWYG editor using the iframe technique. I need to know
I'm working on LAMP application. In my application I'm using iframe . I want
I am trying to fake a file upload without actually using a file input

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.