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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:16:10+00:00 2026-06-08T23:16:10+00:00

I’m converting a Joomla 1.5 component to J2.5 I upload files dynamically. An iframe

  • 0

I’m converting a Joomla 1.5 component to J2.5 I upload files dynamically. An iframe is filled with a form to do this, the iframe has an inner iframe to set the target of the form. After recieving the JSON answer, I use a function on the onload of the inner iframe to erase the iframe and display the uploaded image (using elements of the parent page). Everything works great on J1.5, but on J2.5 I recieve a joomla.json file to download, and seems like the form is not using the target.

The function to display the form on the outter iframe is:

function showUploadImage(evt) {

    if (!document.getElementById("uploadIFrame")) {

        return false;

    }

    var frame = document.getElementById("uploadIFrame");

    var doc = frame.contentDocument;

    var page;

    page = "\

            <html> \

                <head> \

                    <link rel='stylesheet' href='<?php echo JRoute::_(JURI::base().'/components/com_tutorial/css/base.css',false); ?>' type='text/css' /> \

                    <link rel='stylesheet' href='<?php echo JRoute::_(JURI::base().'components/com_tutorial/css/upframe.css',false); ?>' type='text/css' /> \
                </head> \

                <body>";

    page += ' \

            <div id="waitimage"></div> \

            <form id="fileUploadForm" method="post" enctype="multipart/form-data" action="<?php echo JRoute::_('index.php?option=com_tutorial&view=edittutorial&task=savetutimage&tmpl=json&format=json&tutId='.$this->tutId); ?>" target="uploadTarget"> \

                <label class="title" for="images"><?php echo JText::_("UPLOAD IMAGE"); ?></label> \

                <div class="separator25"></div> \

                <div id="pageimages"> \

                    <div id="newimgfields"> \

                        <div class="controw"> \

                            <label class="title" for="image"><?php echo JText::_('SELECT_FILE'); ?></label><input size="35" id="image" type="file" name="image" /> \

                        </div> \

                        <div class="controw"> \

                            <input type="submit" onclick="document.getElementById(\'waitimage\').innerHTML=\'<div class = &quot;mooloader&quot;></div>\';" value="<?php echo JText::_('UPLOAD_IMAGE'); ?>" /> \

                        </div> \

                    </div> \

                </div> \

            </form> \

            <iframe id="uploadTarget" name="uploadTarget" src=""  style="width:0;height:0;border:0px solid #fff;"></iframe> \

            ';

    page += "</body></html>";

    // now write out the new contents

    if (doc == undefined || doc == null)

        doc = frame.contentWindow.document;

    doc.open();

    doc.write(page);

    doc.close();
    doc.getElementById("uploadTarget").onload = uploadDone;

}

And the function executed on the “onload” is:

function uploadDone() {

    var frame = document.getElementById("uploadIFrame");

    var doc = frame.contentDocument;

    var innerFrame = doc.getElementById("uploadTarget");

    var ret = innerFrame.contentDocument.getElementsByTagName("body")[0].innerHTML;

    var data = eval("(" + JSON.decode(ret) + ")"); 

    //var data = eval("("+ret+")"); 

    if (data=="0"){

        alert("<?php echo JText::_('ERROR_SAVE_IMAGE'); ?>");

    }

    else if (data=="") {

    }

    else {

        var upImage = new Element('img',{

            'class':'tutmainthumb',

            'id':'tutThumb',

            'src':'components/com_tutorial/helpers/image.php?img='+data

        });

        upImage.inject('tutImage','top');

        $('uploadIFrame').dispose();

    }


}
  • 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-08T23:16:13+00:00Added an answer on June 8, 2026 at 11:16 pm

    I reprhase this question on: Joomla 2.5 ajax file upload go to that page to check the solution.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.