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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:22:13+00:00 2026-05-20T03:22:13+00:00

It seems like I have not clearly communicated my problem. I need to send

  • 0

It seems like I have not clearly communicated my problem. I need to send a file (using AJAX) and I need to get the upload progress of the file using the Nginx HttpUploadProgressModule. I need a good solution to this problem. I have tried with the jquery.uploadprogress plugin, but I am finding myself having to rewrite much of it to get it to work in all browsers and to send the file using AJAX.

All I need is the code to do this and it needs to work in all major browsers (Chrome, Safari, FireFox, and IE). It would be even better If I could get a solution that will handle multiple file uploads.

I am using the jquery.uploadprogress plugin to get the upload progress of a file from the NginxHttpUploadProgressModule. This is inside an iframe for a facebook application. It works in firefox, but it fails in chrome/safari.

When I open the console I get this.

Uncaught ReferenceError: progressFrame is not defined
jquery.uploadprogress.js:80

Any idea how I would fix that?

I would like to also send the file using AJAX when it is completed. How would I implement that?

EDIT:
I need this soon and it is important so I am going to put a 100 point bounty on this question. The first person to answer it will receive the 100 points.

EDIT 2:
Jake33 helped me solve the first problem. First person to leave a response with how to send the file with ajax too will receive the 100 points.

  • 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-20T03:22:13+00:00Added an answer on May 20, 2026 at 3:22 am

    Uploading files is actually possible with AJAX these days. Yes, AJAX, not some crappy AJAX wannabes like swf or java.

    This example might help you out: https://webblocks.nl/tests/ajax/file-drag-drop.html

    (It also includes the drag/drop interface but that’s easily ignored.)

    Basically what it comes down to is this:

    <input id="files" type="file" />
    
    <script>
    document.getElementById('files').addEventListener('change', function(e) {
        var file = this.files[0];
        var xhr = new XMLHttpRequest();
        (xhr.upload || xhr).addEventListener('progress', function(e) {
            var done = e.position || e.loaded
            var total = e.totalSize || e.total;
            console.log('xhr progress: ' + Math.round(done/total*100) + '%');
        });
        xhr.addEventListener('load', function(e) {
            console.log('xhr upload complete', e, this.responseText);
        });
        xhr.open('post', '/URL-HERE', true);
        xhr.send(file);
    });
    </script>
    

    (demo: http://jsfiddle.net/rudiedirkx/jzxmro8r/)

    So basically what it comes down to is this =)

    xhr.send(file);
    

    Where file is typeof Blob: http://www.w3.org/TR/FileAPI/

    Another (better IMO) way is to use FormData. This allows you to 1) name a file, like in a form and 2) send other stuff (files too), like in a form.

    var fd = new FormData;
    fd.append('photo1', file);
    fd.append('photo2', file2);
    fd.append('other_data', 'foo bar');
    xhr.send(fd);
    

    FormData makes the server code cleaner and more backward compatible (since the request now has the exact same format as normal forms).

    All of it is not experimental, but very modern. Chrome 8+ and Firefox 4+ know what to do, but I don’t know about any others.

    This is how I handled the request (1 image per request) in PHP:

    if ( isset($_FILES['file']) ) {
        $filename = basename($_FILES['file']['name']);
        $error = true;
    
        // Only upload if on my home win dev machine
        if ( isset($_SERVER['WINDIR']) ) {
            $path = 'uploads/'.$filename;
            $error = !move_uploaded_file($_FILES['file']['tmp_name'], $path);
        }
    
        $rsp = array(
            'error' => $error, // Used in JS
            'filename' => $filename,
            'filepath' => '/tests/uploads/' . $filename, // Web accessible
        );
        echo json_encode($rsp);
        exit;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Seems like a simple problem: I have an SVN repo inside our firewall. I
I have a problem that seems like its a result of a deadlock-situation. Whe
It seems like when you have a WinForms .NET application, and a ComboBox (set
I have tried what seems like everything - I've done similiar things many times
It seems like I will be needing transaction with MySQL and I have no
This seems like a pretty softball question, but I always have a hard time
I have been looking through Scott Guthrie's MVC tutorials and it seems like the
Anybody have a slicker way to do this? Seems like it should be easier
I have checked with the wikipedia article , and it seems like it is
Why do PHP regexes have the surrounding delimiters? It seems like it would be

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.