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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T00:58:37+00:00 2026-05-19T00:58:37+00:00

After the form submits, the progressbar appears, and the getProgress function is called. getProgress

  • 0

After the form submits, the progressbar appears, and the getProgress function is called. getProgress check a php file (which uses the uploadprogress apache mod to get the current upload progress) and returns a number from 0 to 100 (which means complete).

OK, The idea is that getProgress is self-executed if the number returned is not 100. Otherwise, the form continues to upload.php where the file is manipulated.

THIS IS WHAT IM LOOKING FOR: http://screenr.com/ByG <- video.

Here is the HTML part.

<form method="post" action="upload.php" enctype="multipart/form-data" id="UploadForm">
    <input type="hidden" id="uid" name="UPLOAD_IDENTIFIER" value="<?php echo $uid; ?>">
    <input type="file" name="file">
    <input type="submit" name="submit" value="Upload!">
</form>
<div id="UploadBarContainer">
        <div id="LoadBar"></div>
        <div id="ProgressBar"></div>
    </div>

Here is the jQuery part. Which seems to be broken

$(function(){

    // This flag determines if the upload has started
    var started = false;

    // Start progress tracking when the form is submitted
    $('#UploadForm').submit(function() {

        //Update the flag to true.
        started = true;

        //Hide the form.
        $('#UploadForm').hide();

        //Show the progress bar.
        $('#UploadBarContainer, #LoadBar, #ProgressBar').show();

        //Start updating progress after a 2 second delay.
        //This is to prevent the getprogress.php assume that upload is complete. 
        setTimeout(function () {

            // We pass the upload identifier to our function
            getProgress($('#uid').val());

        }, 2000);

    });


    //Function used to get the current upload progress.
    //It should be executed over and over again untill the result is 100.
    function getProgress(id) {

        //Get the current time.
        var time = new Date().getTime();

        //Make an ajax request to the server.
        $.ajax({

            //Pass the data trought GET method.
            type: 'GET',

            //Get the progress from this php file.
            url: 'getprogress.php',                         

            //Pass our upload identifier as a parameter and current time to prevent caching.
            data: { uid: id, t: time }, 

            //Get the results.
            success: function (data) {

                //Get the output as an integer.
                var progress = parseInt(data, 10);

                //If upload progress is not 100, change bar percentage and update again.
                if (progress < 100) {

                    //Update the progress bar percentage.
                    //But only if we have started.
                    $('#ProgressBar').css('width', progress + '%');

                    //If we aren't done, update again.
                    getProgress(id);

                }
            }

        });

    }

});

Just i case this helps, here is the getprogress.php file called on the $.ajax request.

if (isset($_GET['uid'])) {
    // Fetch the upload progress data
    $status = uploadprogress_get_info($_GET['uid']);
    if ($status) {
        // Calculate the current percentage
        echo round($status['bytes_uploaded']/$status['bytes_total']*100);
    }
    else {
        // If there is no data, assume it's done
        echo 100;
    }
}

Any help is appreciated, i have a live demo but i scared about what you could upload.

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

    Well finally i came to the conclusion it is not possible to get this working on webkit browsers such as opera, chrome and safari, not so on firefox and internet explorer.

    Webkit browsers tend to block any ajax while a file is being uploaded.

    You may want to check this out: https://bugs.webkit.org/show_bug.cgi?id=23933

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

Sidebar

Related Questions

if Form.Release is called after using the form, it will free all related memory
After my form.Form validates the user input values I pass them to a separate
Whats the normal procedure of clearing a form after POST? Just loop through the
After my web form is submitted, a regex will be applied to user input
After looking on MSDN, it's still unclear to me how I should form a
I have in my Form constructor, after the InitializeComponent the following code: using (WebClient
If I have a HTML form with some embedded div s, and after the
After reading the Head First Design Patterns book and using a number of other
After the suggestion to use a library for my ajax needs I am going
After reading this question , I was reminded of when I was taught Java

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.