Upload Progress Meter for Windows

Frank Kromann applied some patches yesterday to the PECL sources of the uploadprogress extension to make it compile under Windows (almost the same as by SteveH provided in a comment of my post yesterday). Therefore, thanks to the pecl4win site, a compiled dll is now already available. Get it here (untested by me..)

And about the documentation asked in the comments, there are some hints in my earlier post. In general, it works exactly the same as the old patch, which was available for 4.x and 5.0/1, except that the only function available is now called uploadprogress_get_info() instead of upload_progress_meter_get_info().

I may write some documentation, which shows plain and simple, how it’s supposed to work, but can’t promise anything any time soon. But as usual, if anyone else steps up, I’m more than glad to link/include/mention that.

Update: Due to popular demand, I put together a simple example (I tried to make it really simple), all the needed files can be get from here.

Update: For unknown to me reasons, it doesn’t really work on windows. I have no idea why and don’t have a windows developement environment, therefore I won’t/can’t fix it. But everyone is invited to have a look at it (see also the comments).

Update 2 years later: There’s now an “official” release working on windows. See this blog post for more info and this blog post for info about general issues with the extension.

Well – i have it installed – and it dosnt throw any windows errors!

Unfortunately, higher up managment seems to have seemed fit to reduce my programming today to do labor. So i wont be able to make full tests today most likely.

But it does install – it shows up in php_info(), and the function uploadprogress_get_info() does NOT throw up a “function not found” error!!

Glad to see this in PECL =)

I’m still going through the C source of the extension, but if there’s a call for documentation I would be happy to ‘step up to the plate’ and provide some. :)

(very rough explanation of the uploadprogress extension)

Having read through the sample code listed elswhere, i think i have a pretty good grasp of how to run it.

Esentially – you pass a partcularly named hidden input field in your form, with a unique ID for that upload session. As its uploading, it saves the process information in a temp file, who’s location and name are dictated by a php.ini variable (note, this is using windows):


Then, while that is in the process of uploading, a seperate window or javascript thread can be opened, pulling new information every so often from the function ‘uploadprogress_get_info()’ , which has that uique ID as a parameter.

That function will return the number of bytes so far uploaded (as far as i can tell).

Right now, the windows module i have running does not return anything – no matter what is passed into the function. However, i need to do some more testing.

See the update in the post above for a simple example

I have the same experience as SteveH. I have installed the uploadprogress extension (I am using PHP 5.2.0 on WinServer 2003 with IIS).

I have set those four lines in PHP.INI (I am not sure which transcription is OK, so I tried both of them):

uploadprogress.store_method = “file”
uploadprogress.file.filename_template = “c:/temp/upl_%s.txt”
upload_progress_meter.store_method = “file”
upload_progress_meter.file.filename_template = “c:/temp/upl_%s.txt”

And now when I am trying to upload some file with UPLOAD_IDENTIFIER (for example) =1, I can see two files in c:/temp/ directory:


But both of them are static – I supposed they will be updated during upload process, but it is not true, they are still the same. And the function uploadprogress_get_info(‘1’) returns nothing :-(

I suppose there is some problem in the dynamic library.

.store_method isnt used (as far as i can see in the code).

“uploadprogress.file.filename_template” is the proper one to use, and as far as I can tell, the only php.ini attribute used as of 0.3.1-dev.

Likewise, the files are saving, but not being access properly. It seems that a potential fix for that was uploaded a few hours ago into the CVS. We will have to wait till tomrorow for a new pecl4win binary to test with though.

(trying not to act like a small child getting a new toy)

SteveH, yep, that’s correct, there was a bug in the current CVS version, which should be fixed now

Testing 0.3.1-dev PECL4WIN binary this morning.

uploadprogress_get_info() is now returning the proper information. An example of the array it returns is as follows:

Array (
[time_start] => 1165591348
[time_last] => 1165591349
[speed_average] => 4950328
[speed_last] => 4945102
[bytes_uploaded] => 4950328
[bytes_total] => 72237348
[files_uploaded] => 0
[est_sec] => 13

However, one bug did show up. Durring the upload, it never refreshed the data (progress bar started, but never moved once it pulled up).

Bugged it with all info I have:

Thanks to the simple example I have a working progress bar :-) Really good job!!

Stupid questions;

ok the file is uploaded now what? Where is the file? Where is all the $_POST data? Can I have it upload the file then load next page with the post data?


The file uploads like a normal POSTed file. This module dosnt effect that at all, it allows you to run a seperate window (or ajax javascript thread) to check and see how its progressing.

You can use all of your standard file uploading scripts with this module.


There must be something I am missing because I put print_r($_POST); in the file progress.php from the sample but all I get is Array (). I have search all over the machine and can not find where the files is being stored, or how to get to the $_POST or $_FILE data. If you know something I am missing do you have an example file where you are getting
such information? If so can I see it?

Hi, steve,
have you get it working? Everytime I download the extension, It shows the data once, then it does not refresh? is it fixed by today dec-11?

if yes, I might try one more time.


I am using a seperate set of files to test with. Its based off of the original set that Christian linked to, and i have since modified to use for testing. It uses a popup window instead of an ajax bar.

One advice i can give that might help, is to check and see which page your POST is being sent to.

On the page that is recieving the uploader progress data, it will not have access to the $_POST or $_FILES arrays. only the page set in the form “action” attribute will have access to those variables.


No – there has been no updates on it just yet. I am working on building a windows php build enviornment again so that i can get some more testing done. But right now, there has been no patch for it just yet.

If i find any information, i will make sure to post it here.

In correction to my statement earlier, with the windows build, the extension is canceling file uploads. the $_FILES array is returning with the error code of 8, meaning that an extenion interrupted the upload.

I updated my bug posting on PECL with more details, as i believe its directly related to my previous bug.

I have a little more information I see the file while it is being uploaded but once it is uploaded it dissapears, in the example the action page is never reached. I got the progress bar looking really nice :-) but can not get the file :-(

Any other thoughts?


Guys, are you all using Windows? Or does this also happen on other systems?

I’m using my extension just fine with the latest one from CVS on Mac OS X and Linux.

Did you also try with my example from http://files.bitflux.ch/uploadprogress-example.tgz? Does it update the information (but make sure the file is large enough, so that your upload takes at least 2-3 seconds)

If the problem only happens on Windows for you, I won’t be of much help, as I dont know then, why this doesn’t work on Windows (and I still can’t debug there…)

I am a OSX and Linux person myself… I am having these problems on Linux, right now. I am using that example (http://files.bitflux.ch/uploadprogress-example.tgz). I just changed progress.php to show a progress bar instead of the upload array. After the upload is complete the page does not go to upload.php. So I am having problems figuring out
where the file is (form PHP). I can see the file with ls /tmp while the file is uploading but once the file is finished it gets errased. If I remove the call to function progressStart() I get no progress bar but the page does update to upload.php (like it should) and the file can be found.

– Oniedae (Monster Eade)

do you use windows+IIS?
if yes, what’s your url?

Steve H:
Extension never stopped uploading on small files, it doesnot just refresh the stats.
I tried to upload 300MB, I got an error number 8.


It seems that if uploadprogress_get_info() actually gets to see info on an upload that is in progress, it will cut out the upload and have the error return as 8.

I had off-and-on issues with small files. Sometimes it would work, other times it wouldnt. just a roll of the dice i found. But if i turned off the extension, it worked 100% on all files. So i believe if a file passes through without the extension activating, it will still make it.

By the way – i use Apache on Windows for my setup, setting up CentOS right now for a linux environment in Virtual PC to do some more testing.

Well – unfortunately for us windows users, i have gotten it to successfully work beautifully on my fresh CentOS setup. No problems at all that i can tell.

Now we need to figure out whats up with the windows dll…. Still working on getting the proper enviornment built – gonna try Visual Studio .NET to see if using their new command line method will get php to give me a good build that i can work with.

Yes I am officially STUPID this is the windows discussion, my bad. I just commented here becaues I got the example file from here… sorry moving to a different blog.

Since you havent listed any specific issues, let me give you esentially my whole process for setting it up (followed the directions for PECL installations from http://www.php.net/manual/en/install.pecl.php)

For my CentOS setup, i removed all packaged references to Apache and PHP. I then installed them both using their instructions – and got them both running before i attempted the module installation.

Since the latest package still has its bug, i downloaded the latest CSV version using these commands in a new empty folder in my home directory:

cvs -d:pserver:cvsread@cvs.php.net:/repository login

cvs -d:pserver:cvsread@cvs.php.net:/repository co pecl/uploadprogress

(more on this can be found at http://www.php.net/manual/en/install.pecl.downloads.php)

Since its a CVS source i am working with, i used the phpize method for installing PECL extensions (http://www.php.net/manual/en/install.pecl.phpize.php)

cd uploadprogress
make install

and it created the module and told me where it put the .so file. I then added “extension=uploadprogress.so” to the php.ini file, and made sure to set the extension directory to the location it placed the .so binary.

Restarted, and it worked like a champ.

0.3.1-dev will be the one that will give you the only chance of gettng a return.

You have to pass the function the proper UPLOAD_IDENTIFIER to get the function – and that particular form MUST be currently uploading for it to return anything but a null value.

My recommendation – use this sample script:


It is one I created using the original example scripts. It does not use ajax, but a popup, and is really as simplistic as it gets (though i use the original script’s code to build the progress bar). It also tests to ensure that the file properly is recieved by the form’s action page, and ensures that the module is installed and active.

Then set your php.ini to allow large file uploads (if your posting to your local computer with a 1mb file, its going to be done so quick, that the script wont have a chance to run). and try sending it a 500mb file. That should be large enough to trigger it on your local computer.


I am confused, is it working on windows IIS?
if you have apache+windows, you don’t need this extension, use php_apc.dll, it works just fine.

I just can’t get APC working under IIS Windows 2003
that’s why I am looking for an extension.
But It does not seem working. Returns upload status first time, then does not refresh the status.has it been fixed yet?

Any ideas?


I dont believe its working on any windows setup right now. I have compiled it and installed it on a linux installation, and it works just fine. However, when attempted with my apache setup (using the pecl4win binary), it crashes the whole upload (returns an error of 8).

But i have not tested on IIS specifically, just on Apache for Windows, and PHP for Windows.

Dempsey is using a linux install, and my last message was in that context. Same for Oniedae. As far as i can tell, its just been you and me on this blog trying to get working windows binaries for this extension.

When the upload progress hooks where introduced in PHP 5.2 I tested the Rasmus version using APC

The only thing about that one was that I had to use APC to make it work.

Have looked at the solutions posted here and cannot make the windows dll work as expected.
The data is written to the .txt file once an no more.

What I would like to see is that the implementation uses JSON when writing the data to file as well as offering an optional way to store the status.
As it is today it is stored in a .txt file.
Why not optionally offer a way to store the status of the upload using session.
If using session with shared memory (storing session vars to memory instead of file) then speed would probably be twice as fast.

Also would like to see more data stored about the upload.
Would be cool if storing more information about each file being uploaded to server.
Would like to be able to read current file that is being uploaded as well as all files that have been uploaded.

Using JSON to store the data should make this simpler and easier to change latier on.

The link to rasmus talk and examples are here:

Just my 2 cents

Keep up the good work

bongobongo: You shouldn’t build anything on that written file. That’s just an internal thing and the format may change any time…

And about the json stuff


does that all for you right now.

About the other requests, I don’t think I will implement them any time soon…

I tested the latest windows dll
last build: 2006-12-15 06:12:24

I could not get it to work and then wrote a custom script to see what is returned from the
uploadprogress_get_info() function:

After I submit the form with the file to be uploaded I wait another 1 second before I trigger a custom “AJAX” call to the server: from then on I use “AJAX” to check the status every second. Here is the result:

1 call (1 second after upload form has been submitted) to server allways return an empty string from the uploadprogress_get_info() function.
That is a bit weird….. should it take that long before the dll writes status info to some file?

Then 2 call allways returns some information which is nice, but then every call after 2 call is identical to 2 call.

I also noticed that the script that the upload form is submitted to actually never can address the status
about the upload. This is probably because the DLL deletes the related information when all upload is done.

I would very much like to be able to set a php.ini parameter to control if the status information are to be deleted automatically after files has been uploaded or to do this manually in the script that handles the uploaded files.

(*** start to extension or not to extension ***)
Why on earth could not the PHP developers that implemented this upload hooks in PHP 5.2, which actually are very great, make it so we did not have to use an extension to make this work.
Is it that hard to make this into PHP source and then let some php.ini parameters control if to write status to a file or a session var.

One might wonder if it was done this way to force people to use the APC extension?
Rasmus may have an answer to this I guess,
…. any other that know this?
(*** end to extension or not to extension ***)


1) It doesn’t look like to work in Windows. I know :) But I won’t/can’t fix that, as I don’t have a windows developement environement. Therefore someone else hast to step and you don’t have to further write “bug” reports here :)

2) Why do you want to read that info after the upload? It just would say “Everything is uploaded” and makes the handling in the extension more complex. And as mentioned before, not deleting that file automatically adds more issues than it solves IMHO…

3) If it comes with PHP itself or not is really not my desicion…

uploadprogress_get_info() keeps returning NULL for me. I’ve tried the following php.ini settings:

uploadprogress.store_method = file
uploadprogress.file.filename_template = /tmp/upl_%s.txt
upload_progress_meter.store_method = file
upload_progress_meter.file.filename_template = /tmp/upl_%s.txt

The temp files aren’t appearing. I’m running Centos 4. Any ideas?

echo ini_get(‘upload_progress_meter.store_method’);
echo ini_get(‘upload_progress_meter.file.filename_template’);

displays nothing on my PHP5.2 (neither Windows nor Debian)

Could you determine a similar problem?

the only available ini option is


Hey chregu, is “/tmp/upl_%s.txt” correct syntax for uploadprogress.file.filename_template on Linux?

Has anyone been able to link the php_uploadprogress.dll in VS?

I grabbed the latest code from the cvs, and tried building the binary using VS. However, I’m not able to link against php4ts.lib or php5ts.lib (also tried 6ts for a long shot). I’m certain my environment is picking up the lib.

I’m trying to fix the refresh issue in the dll (although I have a feeling that the bug probably lies elsewhere) .

This is the error message I get:
error LNK2019: unresolved external symbol _php_rfc1867_callback referenced in function _zm_shutdown_uploadprogress
1>….Release_TSphp_uploadprogress.dll : fatal error LNK1120: 1 unresolved externals


I’ve installed your extention from pecl
But apache error log shows:

[Sat Dec 23 22:27:57 2006] [notice] SIGHUP received. Attempting to restart
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/lib/php/extensions/no-debug-non-zts-20060613/uploadprogress.so’ – /usr/local/lib/php/extensions/no-debug-non-zts-20060613/uploadprogress.so: undefined symbol: php_rfc1867_callback in Unknown on line 0

Is there anything wrong with my php install?

Thank You

Daniil: It only works with PHP 5.2, are you sure you’re using that?


That’s right 5.2.0 here
Maybe there can be something wrong with my php compilication as apc extention returns similar error

I have compiled, modified /etc/php.ini all correctly.

But I am still seeing NULL in the example package.

So I wonder, because I use lighttpd.. does this works with lighttpd?

Thank you.

Oyeah and ofcourse I am running 5.2 and restarted the webserver ;)

And I have this path in php.ini “/tmp/upl_%s.txt”

But I dont see any .txt files, while uploading in the example package.

I tried *everything*

I have the same problem ,
I am still seeing NULL too(WInXp+Apache2.2+php5.2.0).
Otherway, i am from china,
nice to see ereryone here:).

Lee: It’s obviously not working correctly on Windows and I have no idea, why not (and I don’t plan to look into it more thoroughly…)

lp: No idead about lighttpd either.. sorry.

First off I would just like to say, wicked idea for the extension! I run a Windows box for development and a FreeBSD box for production. Just spent hours going over all my code then the extension source looking for why it wouldn’t upload large files, extension returns error 8. Gonna move what I have to my FreeBSD box and see what happens.

Tank you chregu…
I just test on windows, and i run it on linux…
it work well, good subject…

I like you extension alot! I hope the windows version will work aswell soon, so i can test it on my development! :)

i downloaded http://www.mortur.com/uploader3.zip.
i didn’t modify anything, just used the wayt it is. but i get “Invalid meter ID!” on the popup window.

please someone help me on this. thanks.

Can anyone confirm whether they have got this working on Windows?

My problems are

1) Directly goes to status complete and then page waits until file is downloaded. Saves OK though

2) Cant do a reload of the page by using header. this may be my problem but if debug is set on the page does get loaded in the debug frame

Yes me too I get the “Invalid meter ID!” message, I´m runing on windows 2003 server with Plesk 8.1 and IIS,
can any one tell me what it`s the problem, I try the uploader3.zip and the common example

Can’t get it to work with windows. Always get “Invalid Meter ID”, and ini_get always return empty string :(

I can confirm that the above code (uploader3) does not work on Linux either.
I have apc, uploadprogressmeter installed with php 5.2.1

I get Invalid Meter Id. The code is not commented which is not very helpful. The code falls over here $X = uploadprogress_get_info( $_GET[“UPLOAD_IDENTIFIER”] );

as this is a null value. this is mentioned above but not fully explained. can the person who posted the example explain this in more detail?

The link for the example is broken… :(

Some Great guys Fix The Problem With Win32. Here It Is

Chears Mates

I could make it work on a Windows XP machine by setting

upload_progress_meter.store_method = “file”

in php.ini

and by using the emforge.org version.

The emforge version don’t work for me :(

if (extension_loaded(uploadprogress))
echo “uploadprogress loaded :)”;
echo “something is wrong :(“;

Shows me that the extension is not loaded.

trying to get it to run on a windows (vista) server.
uploadprogress_get_info function is defined but keeps returning NULL.

my form:
<head>upload progress test</head>

<form action=”” method=”post”
enctype=”multipart/form-data” onsubmit=”window.open(‘<?php echo ‘http://’.$_SERVER[‘SERVER_NAME’].’/upload_progress.php?id=’.$id;?>’, ‘Upload_Meter’,’width=370,height=700,status=no,scrollbars=yes’, true);” >



my upload_progress.php:
$id = $_GET[‘id’];

$body = false; // HTML body to display.
$onload = false; // Javascript to run when the page loads.
$refresh = false; // Number of seconds to wait before refreshing the page. false/0 means don’t refresh.
$info = false; // Table of information to display
$url = htmlentities(‘http://’.$_SERVER[‘SERVER_NAME’].$_SERVER[‘PHP_SELF’]).’?id=’.$id.’&e=1′; // URL to redirect to.
$ul_info = uploadprogress_get_info($id);
if(!$ul_info) {
if(isset($_GET[‘e’])) {
$onload = ‘window.close()’;
$body = “Invalid upload meter ID!”;
} else {
$refresh = 2; // Wait 2 seconds, give the server time to create the progress file.
$body = “Waiting for upload to begin.”;
} else {
if($ul_info[‘bytes_total’] > 1 && $ul_info[‘bytes_uploaded’] >= $ul_info[‘bytes_total’] && $ul_info[‘est_sec’] == 0) {
$onload = ‘window.close()’;
$body = ‘Upload complete.’; // They won’t see this if the javascript runs, but just in case they’ve disabled it.
} else {
$body = “Uploading, please wait.”;
$refresh = 1;
$percent_complete = $ul_info[‘bytes_uploaded’] * 100 / $ul_info[‘bytes_total’];
$kb_per_sec = $ul_info[‘speed_last’] / 1000;
$info = array(
‘meter’ => round($percent_complete, 2),
‘width’ => round($percent_complete),
‘eta’ => sprintf(“%02d:%02d”, $ul_info[‘est_sec’] / 60, $ul_info[‘est_sec’] % 60),
‘speed’ => round($kb_per_sec, ($ul_info[‘speed_last’] < 10000) ? 2 : 0),
‘upl’ => nice_value($ul_info[‘bytes_uploaded’]),
‘total’ => nice_value($ul_info[‘bytes_total’]),
<script type=”text/javascript”>
window.onload= function(){
setTimeout(window.location.href = “<?php echo $url; ?>”, <?php echo ($refresh*1000); ?>);
<?php if ($onload!=false) echo $onload; ?>

<?php echo $body; ?>
<?php echo ‘(‘.$info[‘upl’].’/’.$info[‘total’].’)’; ?><?php echo $info[‘meter’].’ %’; ?><?php echo $info[‘speed’]; ?>


i would be very thankfull for some ideas.
ahh, by the way from my php.ini:
uploadprogress.store_method = “file”
uploadprogress.file.filename_template = C:PHPuploadtempupload_%s.txt

My Server is a Sambar Server 7.0 pro whith php 5.2.4 via ISAPI as told above running on a windows vista (ultimate 32bit) machine

Great Daco!! I tried everything but now it works with Windows XP and the EmForge dll!! I only added the following lines to php.ini

upload_progress_meter.store_method = “file”

the emforge version does not work for me (win XP SP2).

the progress file is initially created but never updated (just like the pcel version)

hi guys,

there is a big problem in the way apache handles the requests, which means that this may or may not work for you.

more specifically, on some setups every request fires up a new thread, with it’s own data space, and own instance of php.

this causes the uploading thread to hold the information, but when the data request thread fires the information is, of course, blank for that thread.

i would presume on windows that this is also the case.


someone fix this ?

Some information that might be helpful for folks:

I have been able to test the emforge compiled version of this on Windows with WAMP running Apache 2.2.8 and PHP 5.2.6.

The place to start for emforge is here:

Download both the pecl extension and the php and html files. Drop the web files into a directory somewhere and replace the php_uploadprogress.dll file in the ext directory in WAMP’s php directory (wamp/bin/php/php[version]/ext).

In php.ini add:

uploadprogress.store_method = “file”
uploadprogress.file.filename_template = “c:/wamp/tmp/upl_%s.txt”

Restart the web server.

At first, I couldn’t verify this was working, because I was testing only local files and, no matter the size, they uploaded way too fast for the meter to register anything. However, I found a free Windows program called Speed Limiter that allows you to simulate slow connections to your local web server. It redirects your typical port 80 requests
to a different port (8081 by default). You hit the demo from that port (that is,
http://localhost:8081/upload_demo/demo.html) and you can verify that the uploadprogress extension is working.

Hope this helps someone….

Anyone want to give it another shot on Windows, see my latest blog post

Tried to install on Windows Vista SP1 running Wamp 2.0/Apache 2.2.11/PHP 5.2.8.

I followed Ken’s instructions and it works fine!!

1) Download emforge uploadprogress.dll and install it in: {yourdrive}/Wamp/bin/php/php5.2.8/ext

2) Stop your server,

3) open php.ini

comment php_uploadprogress extension:

add emforge extension:

add the following lines:

uploadprogress.store_method = “file”
uploadprogress.file.filename_template = “c:/wamp/tmp/upl_%s.txt”

4) Save php.ini and restart your server

Now, uploadprogress_get_info doesn’t return NULL!

It Works!!

Great thanks ;)

Chapo: Or get the DLL as described here in another post by me. They should now work, too

I saw this post but unfortunatly it didn’t work for me ;)

Chregu, the pierre files did not work for me either on winxp (test server).
Kens solution has done the trick. I will try both approaches the next time I take down the production server (win server 2003)and I’ll let you know how I make out.

Thanks for everyone’s help.

Ok, I tested it on our windows server. It works just fine. Just make sure, that the path configured in uploadprogress.file.filename_template is writable for your web server

Thanks – been looking for a solution for months!

Demo.html works great on Firefox, Opera & IE BUT not on Safari or Chrome – just get a blank browser screen. I can’t see why . . .

Barry: Did you test it with the examples from the extension itself at http://cvs.php.net/viewvc.cgi/pecl/uploadprogress/examples/ ?

Chregu: I used the set ’emdev_upload_demo’ from http://www.emforge.org/wiki/AjaxBasedFileUploadForPHP

Chregu: Sorry – your suggested example works fine – all browsers I have on Windows & Mac

My issue is with EmForge !

SteveH – Would you be able to help me get this working? I’m trying without success to compile the extension on my CentOS Server.

Hmm well that’s pretty much what I did the first time, just gone through it all again with no luck.

if (extension_loaded(uploadprogress))
echo “uploadprogress loaded :)”;
echo “something is wrong :(“;

That shows it as loaded and it shows in phpinfo(), but when I try and use the example, I get :

Output of uploadprogress_get_info():


Exactly the same result with 0.3.0 beta and 0.3.1-dev

Any ideas what I’m doing wrong? Thanks btw :)

SteveH – Cheers, your example works fine, I guess it was just the example I was trying to use. Thanks for the help :)