Upload Progress Meter – Common issues and some answers

After I released uploadprogress 1.0.0 some days ago and finally declared it as stable, it’s time to write that blogpost about some of the limitations and caveats one has to know.


A great help for testing if the extension works, are the demo files. Put them into a directory on your server and see, what it says. I tried to make the error messages as clear as possible.

Call to undefined function uploadprogress_get_info()

If you get the above message, the extension wasn’t properly installed. Make sure, you restart your webserver after you installed the extension and that it shows up in phpinfo() and there’s an entry like this:


Also check, if the uploadprogress.so really ended up in your “extension_dir” (check that path in phpinfo()) or if you’re using windows php_uploadprogress.dll

Running it on other modules than mod_php on Apache ( like fastcgi)

Unfortunately I only could get the extension running with mod_php on an Apache httpd. I tried with fastcgi, but somehow the hooks didn’t get called and I wasn’t able to investigate further. There’s this bug for that issue, if you have anything useful to add, there’s the place :)

Running on a Windows Server

With the 1.0.0 release from this week, the extension should now also run on Windows. At least, I had feedback that it does (with Apache and XAMPP). Get the DLLs from Pierre‘s download page.

Problems with Suhosin

The suhosin extension had a bug which prevented the uploadprogress from working properly. This bug was fixed in Suhosin 0.9.26 last August.

Temporary files

Please make sure that the path configured in uploadprogress.file.filename_template is set to something, which is writeable for the webserver. I tried to autodetect your temporary folder more accurately than just assume it’s /tmp/ if not properly set. But at the end it was more complicated than I thought and not worth the trouble, as it has only to be set once.

Running on something < PHP 5.2

This is not possible, since the extension relies on some hooks/callbacks only introduced with PHP 5.2.0

Checking if files are too big

I often get asked if it’s possible to abort the upload, if a file is too large. Here’s the hopefully not too long answer:

There are 2 php.ini settings responsible for deciding what’s “too large”.

upload_max_filesize defines the max allowed size of one file. If you have more than one file upload field, each file can have this max size. It is by default 2MB.

post_max_size defines the size the whole post is allowed to take, including all your text-fields and all your file fields. This is 8MB by default and should be larger than upload_max_filesize to make sense.

Now, depending on what limit the post hits, different things happen. If the total post size is larger than post_max_size, then PHP aborts the upload just right at the beginning and never informs the extension about that. The whole upload happens nevertheless, there’s just no data available to PHP at the end. We can’t change that in the extension, there’s never any data coming to the extension. Your only way to handle this is to check on the client side, if no data is getting through to the extension after some time and then inform the user about the fact, that his file may be too large.

On the other hand, if the whole post is smaller than post_max_size but a file is larger than upload_max_filesize you have a chance. The data is getting through to the extension and you can get the current info with uploadprogress_get_info(), for example the size of the file. If that size is larger than upload_max_filesize, you can inform your user, that it’s too large and his upload is futile. The example handles that case with a message. With some client side trickery (eg. reload the upload iframe) you could even abort the upload.

The position and content of UPLOAD_IDENTIFIER within the form is important

The UPLOAD_IDENTIFIER field in your upload form is very important. Without this field, it won’t work properly. Furthermore, the field has to be before the file upload fields in the form. The way it works on the server side is asking for that order.

And make sure the UPLOAD_IDENTIFIER value is unique to the form and is not used anywhere else. If you use it twice for different (simultanous) uploads, the values will be wrong. It’s also better to not use the session-id for this, since if a user uploads two different files in two different forms, the result will be undefined. Something like md5(session_id() . microtime()) should be enough.

The function only returns NULL

First, make sure that the ID used for uploadprogress_get_info() is really the same as specified in UPLOAD_IDENTIFIER. If they are different, it doesn’t work.

Second, if your upload only takes a short time, there may be just no data at the moment you asked for them. Either search for a slow connection, use a huge file (and make sure the ini settings allow such huge uploads) or use something like Charles for throtteling your connection.

Why can’t the extension tell, when an upload is finished?

As you may have realized, when an upload is finished, the extension just returns NULL, as if an upload never happened. This is because the temporary upload data is deleted as soon as the upload is finished. The reason for that is, that we have no other point in time, when we could do that reliably. We could add a function to delete the data manually, but if you forget that (or for any reason never come to that point), you’re disk will gradually fill up with this data.

Another way would be to add something like the session garbage collection to clean old data from time to time. That would be technically possible, as far as I can see.

On the other hand, a useful upload progress is doable without the “it really has finished” info, as the example shows :)

Why not use $_SESSION for the info?

I didn’t dig very deep into that but the way an upload is handled, this is not easily doable. I doubt that a session can already be initialized during an upload. As far as I could see, that’s not the case. Furthermore, the upload and the reading are 2 simultaneous processes, which can lead to problems regarding sessions. But I’d be happy to be proven otherwise :)

It segfaults, when I don’t include UPLOAD_IDENTIFIER

You use a very very very old version of the extension, please upgrade as soon as possible.

Is it stable?

With the 1.0.0 release I declared it as stable, to make those sysadmins happy, which only install stuff marked as stable. So yes, it is now stable :)

Great mod!!!

Just a (maybe stupid) question, what is the difference between using this module and using APC’s APC_UPLOAD_PROGRESS approach??

Is there any reason why this is better?? (Memory usage, better stream flow control, anything else…)

I really am amazed for this module, but would like to know the reason why this was created…

The main difference is: this extension uses the filesystem as temporary storage, APC uses shared memory. And if you’d like to use another Bytecodecache than APC or do not want to install APC for any reason, this one provides that functionality, too.

Furthermore, I don’t know who implemented it sooner, APC or me. This extension is more or less a “fork” of http://pdoru.from.ro/ (same idea, same API), which exists since a long time.

Would be great to see this included in PHP core.


Thx for the answer.

Hi again,

I have been looking further into apc_upload_progress and realized that:

“file upload tracking is not threadsafe at this point, so new uploads that happen while a previous one is still going will disable the tracking for the previous.”

May I suppose that this module does not have the same problem??

I install the extension on my Window machine and works great.

But I have same question regarding UPLOAD_IDENTIFIER: Why not use $_SESSION for the info? :)

I hope you can find workaround to ‘automagicaly’ calculating identifier without UPLOAD_IDENTIFIER.

But… I really hope I can use file “field name” for the IDENTIFIER. Maybe something like we find in MySql to get “insert_id”.

When user upload the file(s), this extension save generated ID for each file name (field name). This ID assosiated with session of the user. We have to call a (new) function directly to get this generated ID (because it will be replaced by new generated ID if there is other upload activity with the same field name)

For example, if we have 2 file fields: “file1” and “file2”.

//First, get the ID
$ID1 = uploadprogress_get_identifier(“file1”);
$ID2 = uploadprogress_get_identifier(“file2”);

//Second, get the info
$info1 = uploadprogress_get_info($ID1);
$info2 = uploadprogress_get_info($ID2);
$totalinfo = uploadprogress_get_info($ID1, $ID2);

It’s sound like stupid suggestion. Isn’t? But I hope it will works.


One more thing…

For advanced developer who use own session handling, maybe above suggestion will not works because this extension did not know what session ID to be use.

So, there is other functions to be added:



As mentioned in this blogpost above, it’s not that easy to use sessions, as a lot of stuff happens before PHP finished initializing. It may be possible, but I don’t have the time to dig into it and I’m not sure, if it’s really worth the trouble, as it’s easy enough to be used with the UPLOAD_IDENTIFIER way

installation and help files would be great. a shame i cant find either here…

Sverre: You install the extension like any other extension for PHP. See http://php.net/install.pecl for the details.

And about the help files, this article here is kind of the help file.

I’ve done everything described in the article but just get no data (null) from uploadprogress_get_info :(
BTW: A temp-file is created in the tmp-folder.

Windows Vista
WAMPSERVER with PHP 5.2.9-2
uploadprogress 1.0.0

Great, just GREAT! Even recently everyone I’ve talked to said that progress bars are pretty much impossible to do in PHP. I last researched about this in maybe 2004, but some developers my company supposedly researched it last year and found nothing. Luckily, they are no longer working there and I am, as it took me less than 3 hours to find this
extension, set it up, and get it working with a really simple js/css progress bar.

The only thing I’d like to see is a link to this entry from the 2006/09/28 one, since it took me hours of reading through comments to find this page! Not that I really needed it, since uploadprogress worked immediately with no issues.

Then again, maybe I was just blind, as I now see the “Related Entries” section, hah.

Joey: Glad you like the extension. I added a hint to the other post on the original post, so that it’s hopefully more obvious. Thanks for the hint.

:) Great.

I found something else today: Firefox 3.5 and Safari 4 [and chrome too, though I’ve read it’s buggy] can upload via XMLHttpRequest and report on the progress. It’s also becoming a W3C standard, which is good news for the future. There’s more info at http://hacks.mozilla.org/2009/06/xhr-progress-and-richer-file-uploading-feedback/ and a working
implementation here http://code.google.com/p/noswfupload/

I only just wrote my script, and it’s already time for a rewrite! I’ll still be using uploadprogress for the majority of browsers that won’t support this for the foreseeable future, of course.

Hi Chregu,

I have been trying to get uploadprogress to run in my Xampp windows installation but no luck. I had a basic xampp installation which I upgraded to PHP 5.3.0 RC, and then copied the uploadprogress.dll into the /ext folder.

I made the following changes in the php.ini file:
uploadprogress.store_method = “file”
uploadprogress.file.filename_template = “xampptmpupl_%s.txt”
uploadprogress.get_contents = “0”

When I do a phpinfo() it doesn’t show uploadprogress. :|
What am I doing wrong here? Does this not work with PHP 5.3?

– Ananth

The DLL provided here http://downloads.php.net/pierre/ are not yet available for PHP 5.3. I asked Pierre to compile it for PHP 5.3 so that it will work there as well

Thanks Chregu,

I will look forward to it. Same goes for php_apc.dll (not available for 5.3).

I was actually looking for php_apc for 5.3 when I came across uploadprogress.

I hope this gets compiled soon. :)

– Ananth

Thank you for building this extension – it looks very useful.
Unfortunately, I am only getting a null value from uploadprogress_get_info(). I have been searching the web and trying various things for almost 8 hours, but with no luck. If anyone has any ideas, they would be greatly appreciated!

Just some points that may help to troubleshoot:
I am running PHP Version 5.2 and uploadprogress shows up in phpinfo. I also used chmod 777 on on the temporary directories and put Suhosin into simulation mode.

Thank you.


Nevermind, I got it to work…

The first problem was that I thought nothing was being written to the tmp directory. Apparently my terminal program was caching the results of the directory listing.

The second was that while testing, I was viewing the contents of uploadprogress_get_info() inside an html textarea (so that it would show line breaks properly). However, Safari 4 kept showing contents of the first result (which was NULL), even though the other elements of the page were updating.

I wanted to share this on the off-chance that someone else encounters the similar problems.

Thanks again for making this extension. Very cool!

This may seem like a strange question, but I don’t seem to see the answer anywhere and as there is no documentation, I can’t seem to figure it out. I’ve installed the pecl extension, placed the 3 sample files in a directory, and based on the script everything works fine. The progress is indicated, it shows the final stats and success. I also see
the file being created in the tmp folder. What I can’t figure out is where the file ends up after deleted from tmp? Or where to set this. So I have no file in the end anywhere. Did I miss something obvious? Please help.

Max: After upload you handle the files like you would without the extension, it’s just the normal PHP way. See


I’ve searched for a PHP 5.3 DLL to use uploadprogress on my Windows server but it looks like neither Pierre nor anyone else has yet built it.

So I took some trouble setting up a VC6 environment on Vista. Tricky one; because VC6 is not Vista-compatible and its installer will not run, this involves manually copying the build environment files from the CD and making a vcvars32.bat to setup the paths to the VC6, PHP and PSDK environments. Also, the 2003 platform SDK is required as that is
the last PSDK to support VC6.

But in the end it worked and I built the PHP 5.3 DLL. For those who wish to use the uploadprogress extension on a Windows server with PHP 5.3 (build ID: API20090626,TS,VC6), here it is:

Make sure to set a correct Windows path for the uploadprogress.file.filename_template setting – the default setting is a *nix path and does not work on Windows. Example working configuration:

uploadprogress.file.filename_template=”C:Program Files (x86)PHPTEMPupt_%s.txt”

hey, i am trying to use this to upload 1 video file but uploadprogress_get_info($_GET[‘ID’]) returns NULL even though:

1) ids are unique
2) hidden field UPLOAD_INDETIFIER is BEFORE file field
3) file size is BELOW post_max_size and upload_max_filesize
4) file is uploaded anyway

am i missing anything?

ok ignore comment. found the problem…are there any other functions, variables, constants to be aware of besides what has been stated for this extension?

Kendall, what was the solution to your problem??
uploadprogress_get_ingo($_GET[‘ID’]) always return NULL…


It seems on my system the temporary file is not being generated. I run Ubuntu 9.04 with PHP 5.2.6, I have mod_security installed and the Suhosin Patch v0.9.6.2. Mod security doesnt seem to be getting in the way, at least it’s not reporting anything in it;s logs.

In my php.ini I have the following…

uploadprogress.store_method = “file”
uploadprogress.file.filename_template = “/tmp/usdsdsdpl_%s.txt”
uploadprogress.get_contents = “0”

Initially I thought maybe the tmp folder could be causing the problem, although it was writable by the web user I changed it to /var/www/ (my web root) but to no avail.

The unique identified field is the first form element and is definately generating a unique value.

Can anyone offer any advice?

Many thanks.

Dale: Did you try with turning those extensions off? Maybe you then can find out, which one is the problem

Thanks for getting back so quickly Chregu.

I have not been able to start turning thngs like that off just yet, unfortunately I do not have access to my dev server at the moment, have you heard of problems with those extensions/versions?

Also, can you think of anything else that may cause the temp file to not be written?

Thanks again.

@Paul, that version worked great! It innstalled withou errors like the other versions (I’m running XAMPP 1.7.1 PHP 5.3) but the progress bar is still the original one. Anyone have any idea’s?

@Paul, the version worked. i got the uploadprogress enabled in php info page for php 5.3 running wamp on windows seven. the only problem i’m facing is that the call to uploadprogress_get_info always returns null. i can’t seem to understand why..
i have also pointed
ploadprogress.file.filename_template = C:/wamp/tmp/upl_%s.txt.
can any one tell what i’m missing??

Runs fine on Apache httpd with PHP loaded as a module (mod_php5) and php_uploadprogress

I was having troubles with APC timing out after 3600 seconds. Setting apc.gc_ttl and apc.rfc1867_ttl to higher numbers did not work.

Changed to php_uploadprogress and got that working. I have got a mixed setup with mod_php and FastCGI. Will try to get it working under FastCGI as well.

Same config, but with PHP as FastCGI:

“Upload succeeded, it took 199.106 seconds. You had 12 updates from the progress meter, looks like it’s working fine.”

I am updating the status far less than in the demo files to minimize server requests. But the conclusion is that this works with PHP 5.2.12 as FastCGI as well.

BTW: Win2k Pro or WinXP Pro as OS both do the trick.

Nice work, Christian!

Hi, i’ve tried Paul’s build on Win7 with php 5.3 under WAMPServer with Apache 2.2.11 and it’s almost working.

Using the demo file, i get the message:

Upload succeeded, it took 7.691 seconds.
BUT there were no progress meter updates
Your upload should have taken long enough to have an progress update. Maybe it really does not work…

It seems that firefox 3.6 freeze during the upload.

Any php settings i might be missing or others??

Thanks for your help

I forgot to mention the possible answer to my previous thread.

I think it is related to session_start. I have one on each script. I’ll remove them and see if it works.


The extension is installed but on the demo no progress is returned, it doesn’t look like the temp files are being created by the extension. I am on Linux and the temp folder is /tmp. Do I have to change the php.ini config at all?

I’m trying to make this work for a couple of hours and can’t get what’s wrong!

When trying the demo files I get this instead of the color bar

Problem. “; if ($template == $templateini) { print “uploadprogress.file.filename_template ($templateini) doesn’t have an %s in it for making unique temporary files. Please adjust.
“; } else { print “$templateini is NOT writable.
Please make sure the directory exists and is writable for the webserver.
Or adjust the ini setting ‘uploadprogress.file.filename_template’ to a correct path.”; } } else { print ‘background-color: green;”>The uploadprogress extension is installed and initial checks show everything is good’; } } else { ?> background-color: red;”>The uploadprogress extension is not installed.

The phpinfo() shows this


uploadprogress support enabled
Version 1.0.1

Directive Local Value Master Value
uploadprogress.file.contents_template /tmp/upload_contents_%s /tmp/upload_contents_%s
uploadprogress.file.filename_template /tmp/upt_%s.txt /tmp/upt_%s.txt
uploadprogress.get_contents 0 0

and the /tmp folder is writable as far as I know
ls -la / shows this

drwxrwxrwt 8 root root 4096 2010-04-26 14:20 tmp/

Do you have an idea what could be the problem?

Installed the extension, but I keep getting this error:

“Upload succeeded, it took 41.253 seconds.
BUT there were no progress meter updates
Your upload should have taken long enough to have an progress update. Maybe it really does not work…”

PHP Info says:

PHP Version 5.2.13

uploadprogress support enabled
Version 1.0.1

uploadprogress.file.contents_template /tmp/upload_contents_%s /tmp/upload_contents_%s
uploadprogress.file.filename_template /tmp/upt_%s.txt /tmp/upt_%s.txt
uploadprogress.get_contents 0 0

/tmp directory is writeable

any ideas where to look?


for Anath and maybe many others…
you get an extension not installed if you dont type your whole path when defining uploadprogress.file.filename_template on XAMPP (windows)
uploadprogress.file.filename_template = “xampptmpupl_%s.txt”
uploadprogress.file.filename_template =
Hope this helps anyone

Paul @ 03.09.2009 22:31 CEST

Thanx man…you are a real lifesaver, been cracking my head trying to enable uploadprogress in my Drupal 6..finally found your VC6 version of Dll…thanx a lot man…:))))

Hi Christian

Did you ever find out what the problem was with running UploadProgress on FastCGI?

I’d really love to use this solution, but unfortunately, most hosting companies I’ve come across seem to use CGI or FastCGI PHP. I’ve got it running on my local Mod_PHP Webserver, and it’s a really great extension, but I’d love to be able to use it in some of my live projects.



Hello! This looks cool, but I can’t install it on Mac OS X 10.6, I tried all day to make it work, I installed it a lots of times from terminal but I don’t see it in phpinfo, and the test files shows me this: The uploadprogress extension is not installed.

But as I see your own demo doesn’t works here http://labs.liip.ch/uploadprogresssimple/index.php so I don’t really know how can be this make it to work :

Hi Cirk

I fixed the demo. It does work again (the uploadprogress extension was not installed :))

404 NOT FOUND – instead of demo files! Could you update url?

Please, upload demo files once again!!!

I fixed the link

I am working with a shared host. I do “pecl install uploadprogress”

It seems to build ok, however it doesn’t install because there is an error.. “failed to write…”

It references the following path “/usr/local/lib/php/extensions/no-debug-non-zts-20060613/uploadprogress.so”

This path ONLY exists in my php.ini as an include path.

All in all, I can’t install because I do not have access to /usr/local/lib/php….. as it is a shared host. I am not sure why it is choosing to use that path..

Any suggestions?

Does uploadprogress always install as a shared extension and if so is there a way to control this?

I see that the configure command checks for PHP prefix, however where is it checking for this because even when I specify a dirrent prefix using –prefix=$HOME it doesn’t use that prefix as the PHP prefix. Is it looking in a php configure file? If so is there a way to determine what file that is?

Hi Ben

You most certainly can’t install this on a shared host. It has to be installed to the extension_dir and this is usually not writeable for non-administrators (for good reasons)

Ask your hoster, if he can install it for you. there’s most certainly no other way.

Now I am installing on my own server and it continues to install to the incorrect extension folder.

I have set the ext_dir to the correct folder in the pecl config but it doesn’t use that, I am not sure why. Therefore it won’t load.


Is there a proper way of cancelling an active upload? I’m sending the upload iframe to a “blank” location, but this seems crufty. Otherwise, works great.

No, there’s no proper way to cancelling an active upload. Or at least not one I could think of.


This link of yours not working anymore..and i can’t install otherwise uploadprogress in wamp2

Please give us some new working link to the VC6 dll
Thank You

@Lehel: look at the end of this other blog entry.

hello every 1. ..

now i have installed (uploadprogress).dll after crossing lots of hurdles. but still also i dont get expected result…, feel really bad..

my uploadprogress_get_info() method always return null…
i want to know whats that problem..,

thanks in advance…

How to manage uploading multiple files in the same html form?

Well, you can use Long Path Tool for such issues, it works good.