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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:12:48+00:00 2026-05-13T00:12:48+00:00

It’s rather lengthy, TLDR version below crit wall of text. Setup : Our company

  • 0

It’s rather lengthy, TLDR version below crit wall of text.

Setup: Our company had been using prototype for some time, and just recently switched to dojo. I have been converting lots and lots of JS and setting everything back up to normal and then I encountered this issue…

The issue: I have a typical form set up with a upload file field. (I’m not using a dijit, and have tried multiple variations of them – not working for me perhaps in 1.4 I will try again.) Upon pressing the submit button my intentions were to watch the upload progress of the files, in prototype this was a simple ajax.PeriodicalUpdater call (wich is basicly xhrGet/Post that runs over and over and over). Coupled with apc.rfc1867 (example: http://www.phpriot.com/articles/php-ajax-file-uploads/3) this becomes very easy, basicly you post, and use ajax to fetch the current progress of the file.

Here is where I encounter the actual issue… xhrPost() doesn’t seem to want to run after the form goes into what I call ‘submit mode’ (where the page is spooling and uploading). APC actually needs the files to be in the ‘submit mode’ to poll the current progress and return the % via ajax.

What I have tried:
Only one thing has partially worked. Using the onclick=”” calling the xhrPost() imediately followed by return false; The problem with this is that the only way I got it to actually work was to click the submit button, and then click a seperate submit button with return false… I think why this worked is that it started a normal submit, then during the upload process it sent the xhrPost() along with return false;. It’s probably the uploads re-started, but what is sure is that the APC data was being fed into the progress bar, unfortunately this shouldn’t require 2 clicks. Also, it didn’t finish submitting the page either.

I’ve had little success using dojo.connect() to the button or the form.

I’ve had little success using onclick=”” unless return false; is present.

I’ve had little success using dojo.io.iframe to send a seperate request.

I’ve had little success using dojox.file.FileUpload, and presents a large sum of it’s own issues as well.

Code Snippets:

Old Code:

new PeriodicalExecuter(function(pe) {
    if( dojo.byId('progressbar').innerHTML == 'Processing...' ) {
        pe.stop();
    } else if( dojo.byId('progressbar').innerHTML != '' ) {
        dojo.byId('progressbar1').setStyle({
            width: dojo.byId('progressbar').innerHTML + '%'
        });
    }
}, 1);

New Code:

    dojo.xhrPost({
        url: 'ajax/apcProgressBar.php',
        content: { progress_key: dojo.byId( 'progress_key' ).value },
        load: function( data ) {
            dojo.byId( 'progressbar' ).innerHTML = data;
            if( dojo.byId( 'progressbar' ).innerHTML != '' ) {
                dojo.style( 'progressbar1', 'width', dojo.byId( 'progressbar' ).innerHTML + '%' );
              window.setTimeout(this, 2000);
            }
        }
    });
}

APC Handling:

if( isset( $_POST[ 'progress_key' ] ) ) {
if( $status = apc_fetch( 'upload_' . $_POST[ 'progress_key' ] ) ) {
    $progress = ceil( $status[ 'current' ] / $status[ 'total' ] * 100 );
    if ( $progress >= 100 ) {
        echo 'Processing...';
    } else {
        echo $progress;
    }
}
echo '...';

}

TLDR Version: I need a way to submit a form with files to upload, and send xhrPost() at the same time, and nothing I try works. The only other variable is that APC must know about the file trying to be uploaded, and stopping the event seems to hinder this completely.

  • 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-13T00:12:48+00:00Added an answer on May 13, 2026 at 12:12 am

    After playing with this some more I came up with my own solution.

    I made a test page that used dojo and prototype. One thing I noticed was that prototype also gave an error in the same situation, this I still don’t understand, however being persistent with the ajax requests will return results, in this instance I used javascripts native setInterval() to continue requesting ajax updates. (I made a custom dojo class)

    Hopefully this helps someone, in the future.

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

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

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.