github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

drogus / jquery-upload-progress

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 99
    • 14
  • Source
  • Commits
  • Network (14)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (2)
    • master ✓
    • safari
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Upload progress bar working with apache, nginx and lighttpd upload progress modules — Read more

  cancel

http://drogomir.com/blog/2008/6/30/upload-progress-script-with-safari-support

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Update in README
 
drogus (author)
Wed Mar 04 09:29:48 -0800 2009
commit  862aa0a39639ddc1efbdbde689ddb03bae86a8c3
tree    585f075be7ec57ba703b5bc55e1425fb574779d8
parent  a518b05fa85b1833bb3a8e8c2a0c8dfb9d6abaf1
jquery-upload-progress /
name age
history
message
file .project Fri Jun 27 06:08:44 -0700 2008 Initial commit [drogus]
file README Wed Mar 04 09:29:48 -0800 2009 Update in README [drogus]
directory example/ Mon Jun 30 04:19:56 -0700 2008 options.jqueryPath and options.uploadProgressPa... [drogus]
file jquery.uploadProgress.js Tue Feb 10 01:00:07 -0800 2009 Add support for JSON-P cross domain updates, li... [deadprogrammer]
directory lib/ Fri Jun 27 06:08:44 -0700 2008 Initial commit [drogus]
README
It can be used with apache upload progress module, nginx upload progress module or lighttpd, read more here: 
http://drogomir.com/blog/2008/6/18/upload-progress-bar-with-mod_passenger-and-apache

Usage:

some html:
     <form id="upload" enctype="multipart/form-data" action="index.html" method="post">
        <input name="file" type="file"/>
        <input type="submit" value="Upload"/>
      </form>
    
      <div id="uploading">
        <div id="progress" class="bar">
          <div id="progressbar">&nbsp;</div>
          <div id="percents"></div>
        </div>
      </div>

then some css:
  
  .bar {
    width: 300px;
  }
  
  #progress {
    background: #eee;
    border: 1px solid #222;
    margin-top: 20px;
  }
  #progressbar {
    width: 0px;
    height: 24px;
    background: #333;
  }

and a bit of javascript:

$(function() {
    $('form').uploadProgress({
    /* scripts locations for safari */
    jqueryPath: "../lib/jquery.js",
    uploadProgressPath: "../jquery.uploadProgress.js",
    /* function called each time bar is updated */
    uploading: function(upload) {$('#percents').html(upload.percents+'%');},
    /* selector or element that will be updated */
    progressBar: "#progressbar",
    /* progress reports url */
    progressUrl: "/progress",
    /* how often will bar be updated */
    interval: 2000
    });
});

If you need to update the progress bar from a different domain or subdomain, liek if your upload server is different 
from your normal web server, you can try the JSON-P protocol, like this:
$(function() {
    $('form').uploadProgress({
    /* scripts locations for safari */
    jqueryPath: "../lib/jquery.js",
    uploadProgressPath: "../jquery.uploadProgress.js",
    /* function called each time bar is updated */
    uploading: function(upload) {$('#percents').html(upload.percents+'%');},
    /* selector or element that will be updated */
    progressBar: "#progressbar",
    /* progress reports url in a different domain or subdomain from caller */
    progressUrl: "uploads.somewhere.com/progress",
    /* how often will bar be updated */
    interval: 2000,
    /* use json-p for cross-domain call */
    dataType: 'jsonp'
    });
});

defaults:

interval: 2000
progressBar: "#progressbar"
progressUrl: "/progress"
start: function() {}
uploading: function() {}
complete: function() {}
success: function() {}
error: function() {}
uploadProgressPath: '/javascripts/jquery.js'
jqueryPath: '/javascripts/jquery.uploadProgress.js'
dataType: 'json'
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server