<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tips for Twits &#187; jQuery</title>
	<atom:link href="http://t.wits.sg/tag/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://t.wits.sg</link>
	<description>WARNING: excessive use of this site will increase MP at the expense of HP</description>
	<lastBuildDate>Mon, 16 Aug 2010 04:09:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>JQuery Progress Bar 2.0</title>
		<link>http://t.wits.sg/2009/06/21/jquery-progress-bar-2-0/</link>
		<comments>http://t.wits.sg/2009/06/21/jquery-progress-bar-2-0/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 02:39:49 +0000</pubDate>
		<dc:creator>gaweee</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[frontend]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[progressbar]]></category>

		<guid isPermaLink="false">http://t.wits.sg/?p=320</guid>
		<description><![CDATA[Hi all its us again, In the past few months we&#8217;ve been asked many a times to help improve the progressbar code. We&#8217;ve also been referenced by several websites as THE progressbar to use. In all, we felt we owed it to you guys to make it better. So here we are, after all those [...]]]></description>
			<content:encoded><![CDATA[<div style="float: left; margin: 0px 10px 10px 0px;"><a href="http://t.wits.sg/wp-content/uploads/2008/06/jqueryprogressbar.jpg"><img class="alignnone size-medium wp-image-11" title="jQuery progressBar" src="http://t.wits.sg/wp-content/uploads/2008/06/jqueryprogressbar.jpg" alt="jQuery progressBar screenshot" width="200" height="200" /></a></div>
<p>Hi all its us again, In the past few months we&#8217;ve been asked many a times to help improve the progressbar code. We&#8217;ve also been referenced by several websites as THE progressbar to use. In all, we felt we owed it to you guys to make it better.</p>
<p>So here we are, after all those emails and bug reports, we finally got down to it. Always good to take a couple of months to have a fresh prespective of things. We ripped out the old code and made it much better and more extensible than its predecessors. So much that we decided it was enough to qualify as a major revision.</p>
<div style="clear: both">&nbsp;</div>
<p>Let see whats been done&#8230;</p>
<ul>
<li>Cleaned up the code, yes its lighter, cleaner faster. (Still lacks documentation though) <img src='http://t.wits.sg/wp-includes/images/smilies/icon_neutral.gif' alt=':|' class='wp-smiley' /> </li>
<li>Callbacks! Everyone&#8217;s favourite</li>
<li>Max values, you can now set it to be 150/2000 instead of just a percentage</li>
<li>Text formats. Show 75/100 or 75% by toggling the <code>textFormat</code> accordingly</li>
<li>Steps, how many steps to get to your target value</li>
<li>Step Duration, how long each step lasts</li>
<li>Webkit (Chrome/Safari) compatibility. More like, Webkit Hacks</li>
</ul>
<p>Once again, many a thanks for all those who have so generously provided the feature requests as well as bug fixes every now and then. And thanks for all your patience in waiting for this new release. <img src='http://t.wits.sg/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /><br />
If its working for you, drop us a comment and tell us where we can see your stuff!</p>
<p><strong>Download the new jQuery progressbar here: <a href="http://t.wits.sg/jquery-progress-bar/" target="_blank">jQuery progressbar<br />
</a>or view the demo <a href="http://t.wits.sg/misc/jQueryProgressBar/demo.php" target="_blank">here</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://t.wits.sg/2009/06/21/jquery-progress-bar-2-0/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>JQuery Progress Bar 1.2</title>
		<link>http://t.wits.sg/2009/02/11/jquery-progress-bar-12/</link>
		<comments>http://t.wits.sg/2009/02/11/jquery-progress-bar-12/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 09:58:01 +0000</pubDate>
		<dc:creator>gaweee</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[frontend]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[progressbar]]></category>

		<guid isPermaLink="false">http://t.wits.sg/?p=27</guid>
		<description><![CDATA[Thanks for all the comments and feedback! By popular request i&#8217;ve added the multi-colored progress bar and fixed some bugs. The new multi-colored bar changes from red to orange and then to green at configurable intervals. Check out the demo! Since the last update this endeavour has seen comments claiming that it works and sometimes [...]]]></description>
			<content:encoded><![CDATA[<div style="float: left; margin: 0px 10px 10px 0px;"><a href="http://t.wits.sg/wp-content/uploads/2008/06/jqueryprogressbar.jpg"><img class="alignnone size-medium wp-image-11" title="jQuery progressBar" src="http://t.wits.sg/wp-content/uploads/2008/06/jqueryprogressbar.jpg" alt="jQuery progressBar screenshot" width="200" height="200" /></a></div>
<p>Thanks for all the comments and feedback! By popular request i&#8217;ve added the multi-colored progress bar and fixed some bugs. The new multi-colored bar changes from red to orange and then to green at configurable intervals. Check out the demo!</p>
<p>Since the last update this endeavour has seen comments claiming that it works and sometimes that it doesnt. I&#8217;ve tested the demo across Safari, Opera, IE6/7, Firefox and Chrome. Havent found any problem. For those of you who have problems, please do email me the problem.</p>
<p><strong>Download the new jQuery progressbar here: <a href="http://t.wits.sg/jquery-progress-bar/" target="_blank">jQuery progressbar<br />
</a>or view the demo <a href="http://t.wits.sg/misc/jQueryProgressBar/demo.php" target="_blank">here</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://t.wits.sg/2009/02/11/jquery-progress-bar-12/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>HOWTO: Readymade Form CSS and Highlighting</title>
		<link>http://t.wits.sg/2009/02/08/howto-readymade-form-css-and-highlighting/</link>
		<comments>http://t.wits.sg/2009/02/08/howto-readymade-form-css-and-highlighting/#comments</comments>
		<pubDate>Sun, 08 Feb 2009 19:48:59 +0000</pubDate>
		<dc:creator>gaweee</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[frontend]]></category>
		<category><![CDATA[highlighting]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://t.wits.sg/?p=25</guid>
		<description><![CDATA[We&#8217;ve been working on web development for awhile now, i&#8217;ve really only seen a handful of pretty forms. The interfaces seen at Uni-Form, mooflex and even to a certain extent linuxjournal are all intuitive and well thought out. So in the good ol WITS culture, we&#8217;ve tried our hand at building our own version of [...]]]></description>
			<content:encoded><![CDATA[<div style="float: left; margin: 0px 10px 10px 0px;"><a href="http://t.wits.sg/wp-content/uploads/2009/02/jquerywitsform.jpg"><img class="alignleft size-medium wp-image-26" title="jquerywitsform" src="http://t.wits.sg/wp-content/uploads/2009/02/jquerywitsform.jpg" alt="jQuery WITSForm" width="200" height="200" /></a></div>
<p>We&#8217;ve been working on web development for awhile now, i&#8217;ve really only seen a handful of pretty forms. The interfaces seen at <a href="http://www.sprawsm.com/uni-form/" target="_blank">Uni-Form</a>, <a href="http://www.mooflex.net" target="_blank">mooflex</a> and even to a certain extent <a href="http://www.linuxjournal.com" target="_blank">linuxjournal</a> are all intuitive and well thought out.</p>
<p>So in the good ol WITS culture, we&#8217;ve tried our hand at building our own version of a universal form interface. Alot of features were borrowed off work already done at <a href="http://www.sprawsm.com/uni-form/" target="_blank">Uni-Form</a>. We just made it jQueried, lighter and more readable. Like all other jQuery plugins, insert jquery.js, insert the jquery.witsform.js script, insert the css, use the right html code, and you&#8217;re done! I&#8217;m pretty sure as time goes by i&#8217;ll keep improving it. So here&#8217;s version 1.0 meanwhile. We bothered so that you shouldnt have to.</p>
<p><strong>download the jQuery WITSForm here: <a href="http://t.wits.sg/downloads/jquery.witsform.1.0.zip" target="_blank">jQuery WITSForm</a><br />
or view the demo <a href="http://t.wits.sg/misc/jQueryWITSForm/demo.php" target="_blank">here</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://t.wits.sg/2009/02/08/howto-readymade-form-css-and-highlighting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HOWTO: PHP and jQuery upload progress bar</title>
		<link>http://t.wits.sg/2008/06/25/howto-php-and-jquery-upload-progress-bar/</link>
		<comments>http://t.wits.sg/2008/06/25/howto-php-and-jquery-upload-progress-bar/#comments</comments>
		<pubDate>Wed, 25 Jun 2008 09:09:18 +0000</pubDate>
		<dc:creator>gaweee</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[backend]]></category>
		<category><![CDATA[frontend]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[progressbar]]></category>

		<guid isPermaLink="false">http://t.wits.sg/?p=16</guid>
		<description><![CDATA[With the controllable jQuery Progress Bar, writing a form upload progress bar seems like a piece of cake now. Hypothetically, all we need is to create the bar, poll for the progress of the file upload, derive the new progress bar value (in percentage) and set it. To do that you need to prepare the [...]]]></description>
			<content:encoded><![CDATA[<p>With the controllable jQuery Progress Bar, writing a form upload progress bar seems like a piece of cake now. Hypothetically, all we need is to create the bar, poll for the progress of the file upload, derive the new progress bar value (in percentage) and set it.</p>
<p>To do that you need to prepare the php script to do it. By default PHP cant report the progress of upload progress. However people smarter than me have already solved that problem. In 5 mins i&#8217;ve found 2 solutions: the <a href="http://pecl.php.net/apc" target="_blank">Alternative PHP Cache (APC)</a> method as well as the <a href="http://pecl.php.net/package/uploadprogress" target="_blank">UploadProgress </a>method. Both of them are PECL packages. Because i couldnt get APC to work on my server properly, i&#8217;ll document the UploadProgress more in detail here&#8230;</p>
<div class="contenblock"><strong>Step 1: Install the uploadprogress package. </strong>Really simple just run the following command  </p>

<div class="wp_syntax"><div class="code"><pre class="language" style="font-family:monospace;">pecl install uploadprogress</pre></div></div>

<p>Once that is done, register the extension to your PHP with the following line in your php.ini</p>

<div class="wp_syntax"><div class="code"><pre class="language" style="font-family:monospace;">extension=uploadprogress.so</pre></div></div>

<p>then restart your apache/httpd</p>
</div>
<div class="contentblock"><strong>Step 2: Create the form and your progress bar</strong>  </p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>form id<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;uploadform&quot;</span> enctype<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;multipart/form-data&quot;</span> method<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;post&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>input id<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;progress_key&quot;</span> <span style="color: #000066;">name</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;UPLOAD_IDENTIFIER&quot;</span> type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;hidden&quot;</span> value<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;&amp;lt;?= $uuid ?&amp;gt;&quot;</span> <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;</span>input id<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;ulfile&quot;</span> <span style="color: #000066;">name</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;ulfile&quot;</span> type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;file&quot;</span> <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;submit&quot;</span> value<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;Upload&quot;</span> <span style="color: #339933;">/&gt;</span>
	<span style="color: #339933;">&lt;</span>span id<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;uploadprogressbar&quot;</span> <span style="color: #003366; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;progressbar&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">%&lt;/</span>span<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>form<span style="color: #339933;">&gt;</span></pre></div></div>

<p>this creates the form with a file field as well as a unique UPLOAD_IDENTIFIER hidden field that allows our script to check the progress of the form submission.</p>
</div>
<div class="contentblock"><strong>Step 3: Next the script itself to check the respond with the progress of the form submission.</strong> Lets call this file <em>uploadprogress.php</em>  </p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Cache-Control: no-cache, must-revalidate&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Expires: Mon, 26 Jul 1997 05:00:00 GMT&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">@</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #990000;">json_encode</span><span style="color: #009900;">&#40;</span>uploadprogress_get_info<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The header no-cache declarations circumvents IE&#8217;s cache of the response. Basically this form does nothing but respond with a json encoded string of the uploadprogress_get_info function. The id argument is the same one we used in the form. Think of it as a form-upload-process-id. A typical response looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #009900;">&#123;</span><span style="color: #3366CC;">&quot;time_start&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;1214384364&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;time_last&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;1214384366&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;speed_average&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;25889&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;speed_last&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;40952&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;bytes_uploaded&quot;</span> <span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;51778&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;bytes_total&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;8125518&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;files_uploaded&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;0&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;est_sec&quot;</span><span style="color: #339933;">:</span><span style="color: #3366CC;">&quot;311&quot;</span><span style="color: #009900;">&#125;</span></pre></div></div>

<p>the response encodes a good deal of data about the form submission. most importantly for us: <em>bytes_uploaded</em> and <em>bytes_total</em></p>
</div>
<div class="contentblock"><strong>Step 3: use jQuery and a timer to keep polling the page and update the progress bar value</strong>  </p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> progress_key <span style="color: #339933;">=</span> <span style="color: #3366CC;">''</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// this sets up the progress bar</span>
$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#uploadprogressbar&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">progressBar</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// fades in the progress bar and starts polling the upload progress after 1.5seconds</span>
<span style="color: #003366; font-weight: bold;">function</span> beginUpload<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#uploadprogressbar&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fadeIn</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	setTimeout<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;showUpload()&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">1500</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// uses ajax to poll the uploadprogress.php page with the id</span>
<span style="color: #006600; font-style: italic;">// deserializes the json string, and computes the percentage (integer)</span>
<span style="color: #006600; font-style: italic;">// update the jQuery progress bar</span>
<span style="color: #006600; font-style: italic;">// sets a timer for the next poll in 750ms</span>
<span style="color: #003366; font-weight: bold;">function</span> showUpload<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	$.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;uploadprogress.php?id=&quot;</span> <span style="color: #339933;">+</span> progress_key<span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>data<span style="color: #009900;">&#41;</span>
			<span style="color: #000066; font-weight: bold;">return</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #003366; font-weight: bold;">var</span> response<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">eval</span> <span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;response = &quot;</span> <span style="color: #339933;">+</span> data<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>response<span style="color: #009900;">&#41;</span>
			<span style="color: #000066; font-weight: bold;">return</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #003366; font-weight: bold;">var</span> percentage <span style="color: #339933;">=</span> Math.<span style="color: #660066;">floor</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">100</span> <span style="color: #339933;">*</span> parseInt<span style="color: #009900;">&#40;</span>response<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'bytes_uploaded'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> parseInt<span style="color: #009900;">&#40;</span>response<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'bytes_total'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#uploadprogressbar&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">progressBar</span><span style="color: #009900;">&#40;</span>percentage<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	setTimeout<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;showUpload()&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">750</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>viola! read the comments if you dont understand the code. it is _THAT_ straightforward. Of course there can be many improvements such as stopping the script when the upload reaches 100% but thats probably not really needed since the whole page is refreshed. But this approach allows the flexibility of ajax submissions and what nots.</p>
<p><strong>Again, download the jQuery progressbar here: <a href="http://t.wits.sg/jquery-progress-bar/" target="_blank">jQuery progressbar</a><br />
or view the demo <a href="http://t.wits.sg/misc/jQueryProgressBar/demo.php" target="_blank">here</a></strong></p>
</div>
<div class="contentblock" style="padding-top: 15px; border-top: 1px dashed #ddd;"><strong>Note:</strong> for the APC solution seekers out there, assuming you can get APC to work, the solution is not so different. A few changes will get your there:  </p>
<ul>
<li>Change the HTML hidden form field name from <em>UPLOAD_IDENTIFIER</em> to <em>APC_UPLOAD_PROGRESS</em></li>
<li>Change the PHP <em>uploadprogress_get_info($_GET['id'])</em> to <em>apc_fetch(&#8216;upload_&#8217;.$_GET['id']));</em></li>
<li>Change the Javascript percentage calculation from:<br />
<em>Math.floor(100 * parseInt(response['bytes_uploaded']) / parseInt(response['bytes_total']));</em><br />
to:<br />
<em>Math.floor(100 * parseInt(response['current']) / parseInt(response['total']));</em></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://t.wits.sg/2008/06/25/howto-php-and-jquery-upload-progress-bar/feed/</wfw:commentRss>
		<slash:comments>48</slash:comments>
		</item>
		<item>
		<title>JQuery Progress Bar 1.1</title>
		<link>http://t.wits.sg/2008/06/20/jquery-progress-bar-11/</link>
		<comments>http://t.wits.sg/2008/06/20/jquery-progress-bar-11/#comments</comments>
		<pubDate>Fri, 20 Jun 2008 11:42:04 +0000</pubDate>
		<dc:creator>gaweee</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[frontend]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[progressbar]]></category>

		<guid isPermaLink="false">http://t.wits.sg/?p=14</guid>
		<description><![CDATA[This code has been downloaded quite abit so i thought i&#8217;d put in some effort to improve it. I found some free time this evening to clean up the code. The original code is a couple of months old and its my first jquery plugin. I didnt quite understand what i was doing then.I made [...]]]></description>
			<content:encoded><![CDATA[<div style="float: left; margin: 0px 10px 10px 0px;"><a href="http://t.wits.sg/wp-content/uploads/2008/06/jqueryprogressbar.jpg"><img class="alignnone size-medium wp-image-11" title="jQuery progressBar" src="http://t.wits.sg/wp-content/uploads/2008/06/jqueryprogressbar.jpg" alt="jQuery progressBar screenshot" width="200" height="200" /></a></div>
<p>This code has been downloaded quite abit so i thought i&#8217;d put in some effort to improve it. I found some free time this evening to clean up the code. The original code is a couple of months old and its my first jquery plugin. I didnt quite understand what i was doing then.I made the code less resource intensive and more configurable.</p>
<p>The progress bar can now be controlled externally. click on the demo link below to see what i&#8217;m talking about. I&#8217;ll know of at least 1 bug in the script if its fully tested, will try to fix this within the week. Meanwhile if you have any ideas for improvements, please leave a comment!</p>
<p><strong><br />
Download the jQuery progressbar here: <a href="http://t.wits.sg/jquery-progress-bar/" target="_blank">jQuery progressbar</a><br />
or view the demo <a href="http://t.wits.sg/misc/jQueryProgressBar/demo.php" target="_blank">here</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://t.wits.sg/2008/06/20/jquery-progress-bar-11/feed/</wfw:commentRss>
		<slash:comments>42</slash:comments>
		</item>
		<item>
		<title>JQuery Progress Bar v1.0</title>
		<link>http://t.wits.sg/2008/06/17/jquery-progress-bar/</link>
		<comments>http://t.wits.sg/2008/06/17/jquery-progress-bar/#comments</comments>
		<pubDate>Tue, 17 Jun 2008 07:09:42 +0000</pubDate>
		<dc:creator>gaweee</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[frontend]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[progressbar]]></category>

		<guid isPermaLink="false">http://t.wits.sg/?p=9</guid>
		<description><![CDATA[I really liked the mootools progressbar at http://www.webappers.com/progressBar/ but i&#8217;m so against the idea of having 2-3 libraries in a single system. Since i always use jQuery, i tried to port the progressBar over. The problem is, jQuery unlike most of the other libraries doesnt quite work with objects. So its not that easy to [...]]]></description>
			<content:encoded><![CDATA[<div style="float: left; margin: 0px 10px 10px 0px;"><a href="http://t.wits.sg/wp-content/uploads/2008/06/jqueryprogressbar.jpg"><img class="alignnone size-medium wp-image-11" title="jQuery progressBar" src="http://t.wits.sg/wp-content/uploads/2008/06/jqueryprogressbar.jpg" alt="jQuery progressBar screenshot" width="200" height="200" /></a></div>
<p>I really liked the mootools progressbar at <a href="http://www.webappers.com/progressBar/" target="_blank">http://www.webappers.com/progressBar/</a> but i&#8217;m so against the idea of having 2-3 libraries in a single system. Since i always use jQuery, i tried to port the progressBar over. The problem is, jQuery unlike most of the other libraries doesnt quite work with objects. So its not that easy to return and manage an object to perform actions like &#8220;add 5%&#8221;, &#8220;fill to 95%&#8221;, etc. Honestly i&#8217;m not sure where else to use such a comprehensive progress bar other than a file upload utility.</p>
<p>So for what its worth, i made a simple progress bar in jQuery that parses a percentage string and animates the loading. <strong></strong></p>
<p><strong>Download the jQuery progressbar here: <a href="http://t.wits.sg/jquery-progress-bar/" target="_blank">jQuery progressbar<br />
</a></strong><strong>Or view the demo: <a href="http://t.wits.sg/misc/jQueryProgressBar/1.0/demo.php" target="_blank">here</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://t.wits.sg/2008/06/17/jquery-progress-bar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
