Blog Posts

Upload Progress Meter extension for PHP 5.2

Showing a real progress bar when uploading large files is an often requested (and quite informative) feature, which is not easily doable with the way the upload handling works in PHP.

There is a patch available for PHP 4.4 and 5.0, which made it nevertheless possible, but some php core files itself needed to be patched for that.

But approx. 2 months ago a similar patch was committed to the PHP_5_2 branch which now makes the patching of PHP unnecessary. You still need an extension for getting the data and that's what I wrote last weekend. It's based on the work of Doru Petrescu, but as the patch is quite different, I started from scratch, but copied some helper functions and the basic idea from Doru's extension.

Here's the code and svnweb.

As this new uploadprogress extension is almost compatible with the one from Doru, you can use his demo files or the ones by Joshua Eichorn described on his blog using the html_AJAX UploadProgressMeter. Just rename the function upload_progress_meter_get_info() to uploadprogress_get_info() in all the files. I made also a little demo available, which should be as simple as possible. The source code is here.

If there's enough interest in the extension, I may try to submit it to PECL. I will also try to add a memcached based mode instead of writing to files.

And as always, use it at your own risk, I didn't test it very thoroughly (especially not at all on windows :) )

Update: It's now finally in PECL: http://pecl.php.net/package/uploadprogress. The latest sources are also available there

Update 2009: If you have problems get it running, see the "common Issues and some answers" blog post and check the new example, which comes with the extension and is also available here.

Related Entries:
- Upload Progress Meter 1.0.1 released
- Upload Progress Meter - Common issues and some answers
- Upload Progress Meter for Windows - The next take
- Upload Progress Meter extension 0.9.2 released
- Upload Progress Meter for Windows

About the author

Comments [188]

Jan, 28.09.2006 12:12 CEST

Neat!

Thanks for the work :-)

Jan
--

Dave Marshall, 28.09.2006 12:44 CEST

Great work Cristian, looking forward to 5.2 going stable so I can put this to work.

Bertier, 28.09.2006 13:33 CEST

Nice work ! Having on the PECL would be great :)

thanx

PHPDeveloper.org, 28.09.2006 14:22 CEST (Trackback)

Harry Fuecks, 28.09.2006 15:40 CEST

Very cool.

What's the role of the filename template BTW: uploadprogress.file.filename_template ? How does the ID you pass into uploadprogress_get_info() from userspace get matched with what the php_rfc1867_callback is reporting as incoming files?

I guess related - annoying edge case question: how do you cope when two files of the same name are being uploaded roughly the same time by _different_ people?

Alex, 28.09.2006 15:53 CEST

Great! Unfortunately I also have to wait until PHP 5.2 goes stable. Anyway you should definitely try to submit it to PECL.

Fabian, 28.09.2006 16:20 CEST

Submission to PECL would be great! Thanx for the work! :-)

Joseph Crawford, 28.09.2006 18:47 CEST

This looks like it will be very useful to the community. Thanks for the hard work to both you and Doru Petrescu.

Carlos Aguado, 29.09.2006 11:01 CEST

Hi Christian: Great work! Would it also be possible to upload the Windows version of this extension to PECL4WIN? Thanks very much!

chregu, 29.09.2006 11:08 CEST

Carlos: I don't have a windows developement environment :)

chregu, 29.09.2006 11:10 CEST

Harry: You have to provide a unique ID as (hidden) input field with the name UPLOAD_IDENTIFIER (and it has to be before the file fields)

How you generate that ID is up to you. But if 2 people get the same ID, then the output will be quite chaotic...

David Bullock, 30.09.2006 01:13 CEST

A PECL extension would be really great. thank you very much for contributing.

Dave

patrick, 01.10.2006 01:21 CEST

waiting for that feature for years now! yes - plase put it into PECL. thank you!

rachid, 05.10.2006 23:31 CEST

the compiler can't find this function multipart_event_start in rfc1867
i use php-devel.x86_64 version 5.1.4-1

chregu, 06.10.2006 07:42 CEST

Rachid: You need PHP 5.2 for this extension

rachid, 08.10.2006 09:34 CEST

under linux is working tanks chregu

i try to install it under windows but i got this message
( Cannot open include file: 'php.h' )

Stever, 21.10.2006 00:49 CEST

Definitely put it in PECL!

Joshua, 02.11.2006 08:06 CEST

I got php 5.2 compiled it for my box, but the example script I pulled down could generates an error:

Call to undefined function apc_fetch().

is there something other than the 5.2 dev I should be getting from snaps.php.net?

David, 02.11.2006 18:18 CEST

Joshua,

Sounds like you need the Alternative PHP Cache: http://pecl.php.net/apc

You can get this package through the PECL/PEAR installer as well.

David, 02.11.2006 22:49 CEST

BTW, PHP 5.2.0 is out now. See http://www.php.net

feuvan, 03.11.2006 08:57 CEST

PHP 5.2 is official
one of the changelog is

Added RFC1867 fileupload processing hook. (Stefan E.)

We hope upm ext will be in official src
or be submited to pecl

thank you!

chregu, 03.11.2006 08:59 CEST

To all guys waiting for the pecl release:

I currently don't have the time to prepare it, so if anyone can help me out, that will happen sooner than later. The sources are here:

http://svn.bitflux.ch/repos/public/misc/uploadprogress/

What's basically missing is a proper package.xml and some testing that the installer really works

And another task would be to try to compile it on windows :)

feuvan, 03.11.2006 10:34 CEST

I wanna get some help from u
I use lighttpd 1.4.13 + fastcgi php 5.2 and upm ext
and UploadProgressMeter mentioned above

but I got a server 503 error while uploading use
demo.php?debug=true

the lighttpd log is
2006-11-03 15:58:30: (log.c.135) server stopped
2006-11-03 15:58:31: (log.c.75) server started
2006-11-03 15:58:38: (mod_fastcgi.c.2396) unexpected end-of-file (perhaps the fastcgi process died): pid: 398 socket: unix:/tmp/php-fastcgi.socket-0
2006-11-03 15:58:38: (mod_fastcgi.c.3181) response not received, request sent: 20849 on socket: unix:/tmp/php-fastcgi.socket-0 for /u/demo.php , closing connection
2006-11-03 16:02:55: (mod_fastcgi.c.2930) write failed: Broken pipe 32


can anyone help me?
thanks

feuvan, 03.11.2006 13:32 CEST

and the up ext version is:
0.1-alpha $Rev: 8198 $

feuvan, 03.11.2006 13:51 CEST

revision 8191 works

it seems that 8198 breaks the upload progress

anyone who wan't to enjoy the amazing thing can svn co -r 8191

please chregu check it
thanks to your hard work

Spirit, 03.11.2006 15:23 CEST

I have some trouble with complining the windows DLL.
VS 6 wants the php.h file which he did not recognice. I got it from PHP 5.2 Source and added it to the project but still gettin the same error :(
>>Include-Datei kann nicht geoeffnet werden: 'php.h': >>No such file or directory

Its a long time ago where i worked with VS 6 so if anyone can help me or has compiled the windows.dll ...

thank you

feuvan, 04.11.2006 19:37 CEST

I have to report a bug
I don't know if it's lighttpd's or the mod's

I've tracked the upload progress.
It seems that in lighttpd fastcgi php environment,
lighttpd handles the upload file,
then transfer the file to php
so php's rfc1867 function invokes the callback
(which is uploadprogress_php_rfc1867_file callback in this module)
in a very very short time.
so the status jumps from "Connecting..." to "Upload Complete"


and I have some question on these lines of codes

88 *e_data->newlength = e_data->length;
maybe it should be e_data->newlength = &e_data->length;

161 if (dt || event >= MULTIPART_EVENT_FILE_END) {
maybe it shoule be MULTIPART_EVENT_FILE_START


thanks

pun1ca, 05.11.2006 19:20 CEST

Hi,

tested it also with PHP 5.2.
The newest revision breaks when a file is uploaded (segment fault), but with the revision before that it works only a bit.
So there is now real upload progress. The Status bar jumps from "Connection" to "Upload Complete" :-/
Using Apache2.

Greatings from Germany

chregu, 05.11.2006 19:25 CEST

There's a known problem (the segfault) which I couldn't fix until now, 'cause I didn't have the time to look into it closer. I reverted that change for now, so it should at least work for some people (while for others it still doesn't)

So don't bother too much for the time being until I found the culprit

pun1ca, 05.11.2006 22:30 CEST

Hi,

anyway nice work you are doin here.
I testet it again and with the PHP-Source from pdoro (the first one) the extension worked a bit more ..
First in only saw the "Connecton" and "Upload completed" messages, with the source from upload-progress-bar-4.1 i could see a process in the uploading, only at the end it fails (the status bar only reloads but doesnt go on), so I inserted some session variables in my code and now its works.

Greating
pun1ca

chregu, 06.11.2006 14:32 CEST

I commited some fixes here and there and it should work better now

Please try it out

daniel, 09.11.2006 10:34 CEST

that demo is very cool.

Joachim Fornallaz, 10.11.2006 09:53 CEST

I compiled revision 8230 and activated it successfully using Mac OS X 10.4.8 and Apache 1.3, but the function uploadprogress_get_info() always returns NULL. Did anyone manage to get the extension to work on OS X?

Dmitri, 12.11.2006 00:12 CEST

The demo on this site does not really work. The progress bar just jumps to Upload complete instantly but the progress is far from complete. Just tru uploading 5MB file and see.

Something is not quire right.

Dmitri again., 12.11.2006 17:52 CEST

I looked inside the /tmp directory while uploading the file and I saw this file: /tmp/upt_%s.txt

I also saw that contents of this file changing as upload continues, which is good, so it means it's working, but I think the % should be replaced by some sort on usique ID and for some reason it's not being replaced.
I think that's why the extension is not displaying the progress properly.

Please look into this and hopefull you can fix it soon. This is the only reason I'm not upgrading to php 5.2.0 and still using 5.1.6 with a upload_progress_meter patch and an old upload_progress extension.

chregu, 13.11.2006 15:46 CEST

Dmitri. It works for me with the /tmp/ file directory. No Idea why it doesn't for you

Dmitri, 13.11.2006 16:16 CEST

I was using it with HTML_AJAX uploadprogressmeter. I changed the function name in one place in UploadProgressMeter class.

I will try to download your demo version and see if it works, maybe I missed something.

I am too developing a CMS in php, focusing on image hosting, but also a blog engine. I have a working version of uploadprogress with patched php5.16 right now.

it's on www.sharedlog.com

Hope to be able to upgrade to php 5.2.0 as soon as I figure out how to make upload progress work with this new extension.

Alex Schultz, 15.11.2006 01:55 CEST

I've modified this module to also support mysql for it's information storage. Who should I send a patch/code to?

Mike Robinson, 25.11.2006 18:13 CEST

I can install this nifty extension on redhat es4, but make chokes on my debian woody box with:

/usr/local/src/php-5.2.0/ext/uploadprogress/uploadprogress.c: In function `uploadprogress_php_rfc1867_file':
/usr/local/src/php-5.2.0/ext/uploadprogress/uploadprogress.c:142: parse error before `crtime'
/usr/local/src/php-5.2.0/ext/uploadprogress/uploadprogress.c:145: `crtime' undeclared (first use in this function)
/usr/local/src/php-5.2.0/ext/uploadprogress/uploadprogress.c:145: (Each undeclared identifier is reported only once
/usr/local/src/php-5.2.0/ext/uploadprogress/uploadprogress.c:145: for each function it appears in.)
/usr/local/src/php-5.2.0/ext/uploadprogress/uploadprogress.c:149: `dt' undeclared (first use in this function)
/usr/local/src/php-5.2.0/ext/uploadprogress/uploadprogress.c:150: `ds' undeclared (first use in this function)
/usr/local/src/php-5.2.0/ext/uploadprogress/uploadprogress.c:151: `d' undeclared (first use in this function)
/usr/local/src/php-5.2.0/ext/uploadprogress/uploadprogress.c: In function `uploadprogress_file_php_get_info':
/usr/local/src/php-5.2.0/ext/uploadprogress/uploadprogress.c:310: parse error before `char'
/usr/local/src/php-5.2.0/ext/uploadprogress/uploadprogress.c:313: `template' undeclared (first use in this function)
make: *** [uploadprogress.lo] Error 1

John, 28.11.2006 09:12 CEST

Can anybody compile that source code?
That would be useful, Please don't be so polarized. Linux is not the end of the world. I need windows .dll file - thanks

Jeremy, 30.11.2006 01:59 CEST

This extension causes a problem with the Suhosin patch. Which probably means it's doing something it shouldn't be doing.

Error message in apache log:
ALERT - canary mismatch on efree() - heap overflow detected

(after which the script is aborted).

Any ideas?

Jeremy, 30.11.2006 02:57 CEST

I found the problem that causes Suhosin to freak out. When you submit a form that has enctype="multipart/form-data", but has no files to upload, the error I described above occurs.

I think this is a bug that could be pretty easily fixed, but I don't know enough about the zend extension API to do this.

chregu, 30.11.2006 07:14 CEST

Jeremy: Did you use the latest version from Subversion? (just to make sure...)

Kelvin, 03.12.2006 11:03 CEST

Hmm. I'm trying to compile it on windows and I get:
Compiling...
uploadprogress.c
c:php-5.2.0extuploadprogressuploadprogress.c(142) : error C2275: 'time_t' : illegal use of this type as an expression
c:program filesmicrosoft visual studiovc98includesystypes.h(28) : see declaration of 'time_t'
c:php-5.2.0extuploadprogressuploadprogress.c(142) : error C2146: syntax error : missing ';' before identifier 'crtime'
c:php-5.2.0extuploadprogressuploadprogress.c(142) : error C2065: 'crtime' : undeclared identifier
c:php-5.2.0extuploadprogressuploadprogress.c(143) : error C2143: syntax error : missing ';' before 'type'
c:php-5.2.0extuploadprogressuploadprogress.c(149) : error C2065: 'dt' : undeclared identifier
c:php-5.2.0extuploadprogressuploadprogress.c(150) : error C2065: 'ds' : undeclared identifier
c:php-5.2.0extuploadprogressuploadprogress.c(151) : error C2065: 'd' : undeclared identifier
c:php-5.2.0extuploadprogressuploadprogress.c(280) : warning C4098: 'zif_uploadprogress_get_info' : 'void' function returning a value
Error executing cl.exe.

php_uploadprogress.dll - 7 error(s), 1 warning(s)


Any ideas - anyone?

chregu, 04.12.2006 15:38 CEST

Jeremy: The remote exec problem should be fixed in my SVN , if it still doesn't work, just tell me ...

Kelvin: No idea about windows, maybe someone else...

SteveH, 04.12.2006 23:56 CEST

Kelvin,

I am running into the same issue, but i believe this particular issue is due to the build code is designed for PHP 4.x - not PHP 5.

I fixed your particular issue by taking the definitions occuring on lines 142 and 143 and putting them at the beginning of the function:

time_t crtime;
int d,dt,ds;

and leaving the actual call behind on 142:

crtime = time(NULL);

and in my case, defining _USE_32BIT_TIME_T in the header (using VC++ 2005 Express).

But i cant get any further with all of the linking refering to a PHP 4.x enviornment.

1>Compiling manifest to resources...
1>Linking...
1>LINK : fatal error LNK1104: cannot open file 'php4ts_debug.lib'

With my limited experience, i cant fix this completely. Any assistance from someone trying this with windows would be a huge help.

David, 05.12.2006 15:48 CEST

SteveH,

I'm surprised that you fixed the compile problems as the problems with linking are relatively simple.

In Visual C++ 2005, open your Project and go to the Project Properities (under the Project menu - or simply press Alt-F7). In the tree of options on the left, go to Configuration Properties, then Linker, then Input and finally look at the Additional Dependencies box on the right. You can change the name of the lib to whatever you need it to be (e.g., php5ts_debug.lib). Note: You may have to change the path to the library under the General options.

I don't know if this needs to be said, but you need to have the phpts5_debug.lib prior to attempting to compile the uploadprogress extension. That means you have compile PHP first (doh!). I find it easier to build Release builds rather than Debug builds since the Release lib comes with PHP distribution (in the dev directory).

Hope this helps.

SteveH, 05.12.2006 17:16 CEST

Thanks for the info!! Thats what i was hoping, that this would be a simple fix at this point. Once (and if) i can get a good compile and get it tested, i will post a link (with Christian's permission) to a windows DLL and the adjusted source code.

I have the source code already downloaded for PHP - and installing the real Visual C++ 6.0 right now to see if this helps make life easier.

I will keep you informed.

chregu, 05.12.2006 17:58 CEST

SteveH: Cool, I'm looking forward to the patches (the automatic build of Windows dlls can then be taken care of by http://pecl4win.php.net/ :) )

SteveH, 05.12.2006 19:38 CEST

If all you need is the patch to make it compile, its a really simple adjustment. (i would send the file, but running on windows, there could be all sorts of issues, so i am just going to describe the fix).

Line 142:

Replace:
time_t crtime = time(NULL);

With:
crtime = time(NULL);


Line 143:

Remove:
int d,dt,ds;


Line 72:

Insert two lines:
time_t crtime;
int d,dt,ds;

(the compiler is just having a fit with defining the variables within an 'IF')

I am still struggling to get a "debug" enviornment built , so the patch is still untested in a DLL form. But it will at least compile now inside of VC++ 6. Any more info on switching to a "release" build would be helpful (i am personally not much of a C++ coder unfortunately).

David, 05.12.2006 20:29 CEST

SteveH,

Switching to a release build is easy. In VC++ 6, go to the build menu, select Set Active Configuration and switch the configuration to "Release."

Of course, you should make sure all the linked in libraries were also built as Release as well.

Fiddling with compilers is a dark art in itself.

SteveH, 05.12.2006 21:45 CEST

http://www.mortur.com/uploadprogress.c.patch

Here is a patch that i made with the PECL CVS. I couldnt get an enviornment to work here, so i hope we can get it running on pecl4win.

George Adams, 06.12.2006 01:09 CEST

Following the advice of some previous posts, here are the changes I made to uploadprogress.c to get it complile on Solaris 8:

Insert at line 72 (right after "int read_bytes"):
time_t crtime;
int d,dt,ds;
---------------------------------------------
Change line 143 from:
time_t crtime = time(NULL);
to:
crtime = time(NULL);
---------------------------------------------
Remove line 144 ("int d,dt,ds;")
---------------------------------------------
Insert at line 308 (right after "char * filename;"):
char * template;
---------------------------------------------
Change line 311 from:
char * template = INI_STR("uploadprogress.file.filename_template");
to:
template = INI_STR("uploadprogress.file.filename_template");

Jeremy, 06.12.2006 23:14 CEST

Ah, I was using the tar that's linked to in the post. I'll try the one from PECL (it seems to have been updated yesterday so it's probably pretty up-to-date, right?)

Ryan, 08.12.2006 20:43 CEST

I've looked everywhere to try to sort out how to do this. Now I've tried every possible way to get this to work..

I have php 5.2.0, I tried getting a progress meter to work with apc.rfc1867, but was unable to do so, and alas came across this extension. I now have the PECL extension installed, but can't seem to ready anything from uploadprogress_get_info()... The upload will start, and the progress bar will jump straight to complete, while the upload carries on in the bg.. can be seen here:

http://enterinside.com/users/modules/gallery2/progress/demo.php

Any help is appreciated

Thanks

SteveH, 08.12.2006 21:00 CEST

Try the latest CVS version (0.3.1-dev), there was a bug that caused that - which has been fixed.

Ryan, 10.12.2006 00:18 CEST

Where do I find the latest CVS version? - thnx

Motin, 11.12.2006 11:51 CEST

Your extension worked great after I installed php 5.2.0 and changed the function-calls as instructed! Plug-n-play! :)

Thanks for the hard work!

Although - it has stopped working. Today - the uploadprogress php function returns NULL when a file is being uploaded. I can track the progress manually by watching the size of the phpAAAAAA-file in /tmp. I have traced the "error" back to the fact that there no longer is a file called upt_something.txt created in php temporary upload folder (I didnt verify that it was there when it was working but I have guessed my way to the fact that it probably were since the entension - using the default ini-value of uploadprogress.file.filename_template - relies on this file?)

I am not sure about this, but I think it was around the same time that I on top of the suhosin-patched php also installed the suhosin extension. This is a bit strange if it would be the error since usually suhosin is very good at logging stuff when it prevents something to happen but no output from suhosin is generated...

I am running Apache/2.0.55 (Ubuntu) PHP/5.2.0-0.dotdeb.3 with Suhosin-Patch mod_ssl/2.0.55 OpenSSL/0.9.8a

I just updated your extension from 0.2 to 0.3 - the problem persists.

Now:

1. Any frank ideas on what could be the matter here?

2. Could you have the extension throw an error or something similar for examle E_UPLOADPROGRESS_NOPROGRESSFILEFOUND if the file is not found?

Best regards,

Fredrik

chregu, 11.12.2006 12:11 CEST

Motin: First, can you please test the CVS version, if possible. I made some fixes (but mainly for bugs introduced after 0.3.0), maybe there was something wrong in 0.3.0, too (but I use that version and it works for me)

And for the second request, the function returns NULL, if no file found (or something else is wrong, but usually it's a file not found). The problem is, that when the upload has finished, the file isn't htere anymore, and it would return that then, too. Which would be a little bit strange IMHO...

Motin, 11.12.2006 16:03 CEST

Thanks for anwsering so quickly!

I ask the same as Ryan above: Where do I find the latest CVS version? Should I download the files one by one from https://ssl.bitflux.ch/horde/chora/misc/uploadprogress/ ?

Maybe you should have the command for anonymous checkout in your blogpost.

About the second request - A user should be able to write code that always expects the extension to return something about the upload in progress. In case nothing is found, an easily suppressed notice could be thrown to alert about this.

chregu, 11.12.2006 16:12 CEST

Motin: The latest CVS sources are here: http://cvs.php.net/viewvc.cgi/pecl/uploadprogress/

A short description, how to download that is here
http://www.php.net/anoncvs.php

For the 2nd request: I will not throw a "notice" for expected behaviour. When the upload is finished, the file is gone and returning a notice there is just bad practice IMHO. I can't differntiate between "no file at all" or "no file because the upload has finished or not started yet". The upload process itself and the one which calls uploadprogress_get_info are completely independent of each other and they can't talk with each other except through that file (and no, I can't write into that file "upload finished" since it has to be cleaned somewhere and that somewhere has to be in the upload process itself)

If uploadprogress_get_info returns NULL, then there's no file. There are no other states, therefore that should be enough and you can check for NULL in your code

Motin, 11.12.2006 22:47 CEST

Would you mind specifying the direct checkout-path to your extension? I am not too kern about checking out the whole php source tree and I am not too familiar with cvs. It seems there is a subversion repository where the extension lies as well? I use subversion daily. Do you have the direct path to the folder in the repo? Tried scn checkout https://ssl.bitflux.ch/horde/chora/misc/uploadprogress/ without success...

> and no, I can't write into that file "upload finished"
> since it has to be cleaned somewhere and that
> somewhere has to be in the upload process itself

Why not? It is a great function as soon as the user has chosen the behaviour, for instance through uploadprogress.leave_uptfile_after_finished_upload=1

And then let the extension cleanup upon finding the upload finished. The user will know that he has to cleanup manually if he enables this option for the uploads that were aborted.

Ryan, 11.12.2006 23:09 CEST

"Maybe you should have the command for anonymous checkout in your blogpost." - I've never done this before so after some monkeying around:

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

Ryan, 11.12.2006 23:17 CEST

hmm. I just finished upgrading the latest cvs version, and nothing has changed - progress bar still just jumps to finished.

Could I be missing some ./configure options or something like that?

chregu, 11.12.2006 23:33 CEST

Ryan: Maybe the upload is just too fast :) Or did you try with a large file over a slow connection?

Morton: I won't change it. Really :) Your proposal brings more problems than it solves for the various reasons I mentioned above (mainly 2 different processes, which both can be aborted or not finished independently. Not even the cleanup has to be called and then you have many stale files laying around).

Ryan, 12.12.2006 03:13 CEST

I've tried uploads of various sizes.. and as mentioned. the upload will continue on, and finish at normal time, while the progress bar just jumps to finished right away.

Ryan, 12.12.2006 03:18 CEST

I wrote my own simple upload script, to test to see if it would work. It doesn't use ajax to display the status, it rather, just reloads an iframe given the upload_identifier, to see if the status function was actually returning anything.. It just returns null...

Oniedae, 13.12.2006 12:44 CEST

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 (from 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, 14.12.2006 09:03 CEST

OK nevermind, I understand now upload.php is going to the iframe. I totally missed that.

BenV, 14.12.2006 10:54 CEST

Hye,
I installed your PECL extensions (downloaded from http://pecl4win.php.net/list.php/5_2) on WinXP, with PHP5.2. The Phpinfo() said me that it was well installed.
Then, I 've downloaded the demo files from Doru Petrescu and renamed the function upload_progress_meter_get_info() to uploadprogress_get_info(). My problem is that when I try this demo file on my web server, the popup gives me an error message : "Invalid meter ID!". It seems that uploadprogress_get_info doesn't return anything. I don't understand why ... Any idea ?

Other question : Is it possible to set the temporary folder to another path ?

Sorry about these "silly" questions ...

SteveH, 14.12.2006 18:07 CEST

The Windows version of the extension is still having difficulties - http://blog.bitflux.ch/archive/2006/12/05/upload-progress-meter-for-windows.html.

However, in your case, it is most likely an issue with the upload completing before the popup window has a chance to request information about the upload.

I am using that same script, and have to turn up my upload allowances to 500mb in order to get a decent amount of time to upload to my local computer.

guest, 15.12.2006 18:43 CEST

great work
where can we found some proper documentation about how is this extension supposed to work.

doublemax, 18.12.2006 16:08 CEST

It works (at least on debian)! Great stuff! Thx a lot.

This is the first extension from PECL I really use.

Ryan, 02.01.2007 09:50 CEST

Any idea's on my problem?

Markus Doppelbauer, 10.01.2007 14:24 CEST

Just a quick note. Would it be a big thing, to also use GET parameter?

This code (simplified) works:

<form action="/u.php">
<input type="hidden" name="UPLOAD_IDENTIFIER" value="abc" />
<input type="file" name="filename" />
</form>

This code doesn't work:

<form action="/u.php?UPLOAD_IDENTIFIER=abc">
<input type="file" name="filename" />
</form>

Thanks in advance
Markus Doppelbauer

zack, 12.01.2007 21:12 CEST

first of all... thanks so much for doing all this. i hope to be using your extension soon.

my hosting company is trying to install the extension for me. unfortunately i don't have my own server to work with. they have told me that their first attempt to install your extension was unsuccessful...

has anyone had success installing the extension with an apache 1 / cpanel setup? any advice or pointers here would be greatly appreciated.

blessings...

SUUUUUMEEERRRR, 27.01.2007 11:29 CEST

I DOWNLOADED THE ZIP FILE IT JUST HAS SOME "README" CRAP IN IT WITH SOME URLS...


WHAT THE .. JEEEEEZZZUZZ..

chregu, 27.01.2007 11:34 CEST

Suuummeeer: Just read the text in that readme and follow the URLs... or reread the blog post above again, especially the note at the end about "It's in PECL now"...

And hey, are you related to that guy here:
http://trash.chregu.tv/instructions.txt ?

SUMERE, 28.01.2007 14:14 CEST

pfff. maybe its your brother who wrote all that explicit language.

i know more about donkeys, mysql and everything inbetween than you do.

chregu, 28.01.2007 14:31 CEST

No further comments needed then from my side, mr. know-it-all :)

SUUMERE, 28.01.2007 23:24 CEST

This blog or article is completely useless, you dont have to deny help when you dont even know how to help others, only reason your article/blog is getting some attention is due to the fact that HOOKS is new feature in PHP 5.2 and not many have published blogs about it yet.

Congradulations on being able to convince yourself that you are a genius by publishing a stupid article and a very poorly designed MOD which does not even have a LIVE DEMO , i am not even going to waste my time going through this article, i know i would be wasting my time , and i feel sorry for anyone who spends time trying to use this script/whatever only to figure out it is constructed in very stupid ways and completly useless.

Making things look complex and screwing up all just so that it can make you look intelligent might be a good way to get into the spotlight for a while but i don't think people will accept it, and they cant wait to find an alternative source.

i am sure within a few weeks someone will publish a simple way of using the PHP 5.2 HOOKS with 3 LINES OF PHP CODE. with an AJAX.js included on top. thats all there is to it.

infact eventho i am a newbie at this, i can say it on top of my head that what is needed is a simple
AJAX.JS on top
and a custom.php?tempfile=juice.mov file which can check total uploaded on the temp file in the temp folder every 0.5 seconds.

i am just pissed off that i keep finding this stupid useless article on google everytime i search for php 5.2 upload progress meter.

i guess google's spot is up for grabs. maybe i should just start a search engine and ban all your useless unnecessarly complicated articles and bs blogs.

SUUMERE, 28.01.2007 23:28 CEST

I should also add... You are just another Stephen Hawking wannabe, and in my own opinion...

Stephen Hawking is the most retarded, the most stupid idiot alive in the universe.

chregu, 28.01.2007 23:31 CEST

Funny enough that no one else came up with an easier solution than mine... So I'm still waiting

And your proposed "solution" is not gonna work, but be my guest to prove me wrong...

Anyway, keep babbling, it's kind of entertaining...

SUUMERE, 28.01.2007 23:36 CEST

Why dontt you like find a 500 MB pdf or text file somewhere on google and attach it to your project's files just so it can make you look more of a genius.

AnotherUser, 01.02.2007 17:09 CEST

It's nice to the developer actively participating in this thread but the lack of comment regarding the broken windows version is disheartening (when he is so eager to banter with an uncouth user).
Any news on why it doesn't work/ how to fix it?

thanks

chregu, 01.02.2007 17:11 CEST

I made it hopefully clear enough...

I can't and won't fix the windows version. Someone else with knowledge in that area has to step up..

If I would know, why it doesn't work or how to fix it, I would have done it long time ago..

Motin, 27.02.2007 04:01 CEST

Your extension just won't work any longer. It did once after installing php 5.2.1, then when I tried one week later it wouldn't work. I can't remember exactly what I did in between so i cannot track it to a change in server configuration or code.

Always getting empty responses from uploadprogress_get_info() nowadays.

I have tried this in php.ini:
[uploadprogress]
uploadprogress.file.filename_template=/tmp/upt_%s.txt

But when watching /tmp all I can see is the temporary uploadfile php creates. No upt_%s.txt anywhere!

UPLOAD_IDENTIFIER hidden value is set first in the upload form.

Tried both 0.3.0-beta from pecl and 0.3.1-dev from CVS.

What can I do to debug this issue you think? Uploadprogress is _very_silent about everything, the documentation has no info about troubleshooting and the phpinfo() output is not very useful (only a version number...)...

Motin, 27.02.2007 04:54 CEST

Disabling the suhosin php5 module makes the upt-file being created. The file is however stale, always containing information about that 5kb has been uploaded.

Going nuts on this. Ideas?

Sean Hogan, 24.03.2007 00:52 CEST

What is this error all about...

object(undefined) (5) {
["message"]=>
string(25) "content has no properties"
["fileName"]=>
string(92) "http://XXXXXXXXXXXXX/main/demoserver.php?client=main,request,httpclient,dispatcher,json,util"
["lineNumber"]=>
number(1065)
["stack"]=>
string(306) "()@http://XXXXXXXXXXXXX/main/demoserver.php?client=main,request,httpclient,dispatcher,json,util:1065
()@http://XXXXXXXXXX/main/demoserver.php?client=main,request,httpclient,dispatcher,json,util:1034
()@http://XXXXXXXXXX/main/demoserver.php?client=main,request,httpclient,dispatcher,json,util:943
@:0
"
["name"]=>
string(9) "TypeError"
}


Everything worked fine for a while, not sure what broke.


GOOOD STUFF!! THANKS!

newbie, 03.04.2007 00:19 CEST

Hi.

Can anyone provide me with a list of functions for this extension? I can't find it anywhere.

Thanks.

Franck, 06.04.2007 01:18 CEST

It doesn't work with simultaneous uploads.
Just open 2 browsers and upload two big files simultaneously and the progress bar will fail.

Or maybe I did something wrong. Can you help ?

Ite, 29.04.2007 11:48 CEST

The extension worked for me just fine before I moved to a new server. And stopped. I found something here http://blog.php-security.org/archives/58-Suhosin-caught-another-remote-code-execution-vulnerability.html
That's not solution but explanation.

John, 08.05.2007 15:55 CEST

Are there install instructions on this? I downloaded the uploadprogress-0.3.0.tgz from PECL and can't find any instructions on how to use it.

Jude Aakjaer, 14.05.2007 07:36 CEST

Some help with this extension would be great. I've installed it on two servers now and they are both reporting the same errors

I've put into php.ini
[uploadprogress]
uploadprogress.file.filename_template=/tmp/upt_%s.txt

and /tmp has full 777 chmod
However, nothing ever appears in there from this extension and uploadprogress_get_info() always returns NULL. Is there any dependencies that I should be aware of? (other then php5.2 of course)

Thanks

Jude Aakjaer, 14.05.2007 07:37 CEST

Also in regards to Ite with Suhoshin, one of the servers has Suhoshin installed, the other doesn't, but both are failing in the same way (showing just null)

chregu, 14.05.2007 07:38 CEST

Jude: How does your script look like? Do you try with an large enough file? Is it smaller than the usual file upload ini parameters in PHP?

Jude Aakjaer, 14.05.2007 09:08 CEST

Hey Christian,

I'm using sample code from here
http://nata2.org/2007/04/16/pecl-uploadprogress-example/

His archives are a little broken so I had to hunt around for the right code

in part, this is what the important things look like

upload.php -
<?php
$unuiq= uniqid();
?>
-in form




- progress.php
<?php
$unique_id = $_POST['UPLOAD_IDENTIFIER'];
$uploadvalues = uploadprogress_get_info($unique_id);
var_dump($unique_id);
?>

it always var_dumps NULL as the value

the code from his site has an error as well on progress.php as he is trying to get $_POST['uniqu'] instead of $_POST['UPLOAD_IDENTIFIER'];

As I mentioned as well, it never shows up anything in the /tmp dir to start off with :-/

Does that php.ini directive need to be in there before the module is compiled into php? Do I have the syntax of that directive correct? Just going out on a limb here as this is the first module I've used from PECL and I can't get it working, hehe

Jude Aakjaer, 14.05.2007 09:09 CEST

-in form

input type="hidden" name="UPLOAD_IDENTIFIER" id="progress_key" value="<?php echo $unuiq; ?>"/
input type="file" name="file1"/

shine India, 16.05.2007 09:20 CEST

Quite nice work ! Thanks for this code..

John, 21.05.2007 04:41 CEST

Just adding a bump in here since I didn't get an answer, hoping that my question didn't get lost in the shuffle. I downloaded the uploadprogress-0.3.0.tgz from PECL and can't find any instructions on how to use it. Is there some sort of walkthough or something available to teach me how to incorporate this into my current website? Any guidance is more than appreciated. Thanks in advance.

Alexey Kakunin, 21.05.2007 15:42 CEST

Seems we finally managed to make this extension working under Win32. Details about problems we fixed as well as fixed sources & project files and compiled dll you can find at http://www.emforge.org/wiki/AjaxBasedFileUploadForPHP

Not 100% it will work in all cases - we are not very experienced in the PHP extensions development - but it is working in our case

chregu, 21.05.2007 15:56 CEST

Alexey: Thanks a lot for that. Looks ok, but did you intentionally change

VCWD_FOPEN() to fopen() and if so, why? :)

Alexey Kakunin, 21.05.2007 19:50 CEST

Do not know there it is better to answer - here or in bug-description - so, will answer in both places:

Yes, we changed VCWD_FOPEN to fopen... As I wrote - we are not very
familiar with PHP Extensions development - and fixed this extension only because we needed it urgently.

We found that if we used VCWD_FOPEN
function - we got 'lock' exception from latelly called fprintf or
fgets... Probably, instead of these functions we should also use some
PHP-specific functinos for working with files - I do not know - but
changing from VCWD_FOPEN to fopen let us avoid these problems

Stulliein, 30.05.2007 14:55 CEST

Hi
Great code... but where's the doc?
No, the demos mentioned here don't work at all on my side and I would like to figure out how to use that by my own but without a doc, as I don't know C++, I can't figure...

Greetz

Stulliein, 30.05.2007 17:54 CEST

Now I got a demo to work... well, it uploads files... but that's pretty much what it does... the Progressbar doesn't work at all. I tried to upload a 7MB file to my remote server. The progress says "connecting" and after a while (2-3minutes) the bar suddenly goes blue and it says "upload complete" --- the file is on the server then in the correct directory though the bar didn't show a continue progress... it just jumps blue when the upload is ready...
I have no clue at all what's happening there... Is there something what I have to configure, that AJAX get's the continues progress without waiting for the upload to finish?

--
Greetz

Kris, 04.07.2007 23:53 CEST

Hey Alexey Kakunin,

Tries your example and the progress bar doesnt work in both IE and FF. In IE the upload soesnt work at all, I just get Uploaded file list. In FF I get a 'please wait' for about 2 seconds then bar turns red and then finally I get the results.

I wasnt sure what to do with the 'uploadprogress' attachment so I just put the files in the same directory as the upload files.

hendri, 26.07.2007 07:32 CEST

How if i just want to use php file and javascript file??? not other!

tayyab shaikh, 24.08.2007 08:07 CEST

i want use popup msg "please wait file is uploading" in my application when file is uploading
can u help me

tayyab shaikh, 24.08.2007 08:08 CEST

Now I got a demo to work... well, it uploads files... but that's pretty much what it does... the Progressbar doesn't work at all. I tried to upload a 7MB file to my remote server. The progress says "connecting" and after a while (2-3minutes) the bar suddenly goes blue and it says "upload complete" --- the file is on the server then in the correct directory though the bar didn't show a continue progress... it just jumps blue when the upload is ready...
I have no clue at all what's happening there... Is there something what I have to configure, that AJAX get's the continues progress without waiting for the upload to finish?

Marko, 30.08.2007 21:18 CEST

Great job, man!

Dmitriy, 07.09.2007 10:19 CEST

Very good work. Thanks for developers... Scripts work cool.

Philip Butler, 11.09.2007 15:56 CEST

Hi,

I am trying to get this extension running for an upload progress indicator. I have done this:

pecl install uploadprogress channel://pecl.php.net/uploadprogress-0.3.0

but the function uploadprogress_get_info is not found. I used the following on the page:

if (!function_exists('uploadprogress_get_info'))
echo "uploadprogress_get_info not found

";

Any clues as to what I am doing wrong ??

T

SMT, 18.09.2007 12:22 CEST

I tried a lot codesamples, some basing on uploadprogress some on the apc.rfc1867 hook, but i got the same result with ervery try. both (auploadprogress_get_info() as well as apc_fetch() stay empty till the end of the upload. after upload is finished they report correct data (like size, rate etc...) I tried it with php 5.2.4 on a windows server as well as with php 5.2.3 on a linx system. everytime the same shit (sorry).
I would be very pleased if someone could give me some advice how to get even one of the functions to work.
Thanks in advance

SMT

dane, 21.09.2007 19:01 CEST

This wouldn't work for a windows box, would it? I don't have the privilege of recompiling. If anyone knows of a way to implement this on the latest PHP version for windows, with apache2, let me know.

Jai, 27.09.2007 00:41 CEST

Sweet, I've been using 5.2 since pre-release and I never noticed that the information was already available, I had actually hacked in the old patch and compiled, had I known I would've written an extension but you already have! thanks!

Jai, 27.09.2007 00:43 CEST

PS. It's also sweeter because now that I shouldn't have to patch my php, I can use a packaged version of php, which also enables my app to run on more servers with the simple install of the extension..!

Motin, 27.10.2007 03:17 CEST

I still cannot use this due to the canary heep overflow bug that Suhosin spots (http://blog.php-security.org/archives/58-Suhosin-caught-another-remote-code-execution-vulnerability.html).

Does the author intent to develop this extension further or is it good enough as it is - only working on insecure environments?

Thanks for the extension it's a pity many can't use it...

chregu, 27.10.2007 09:33 CEST

Motin: What's the problem? The security issue was fixed the day the problem was published and that was before it even was in the PECL CVS (that may explain, why you missed it ). The fix is certainly in the 0.3.0 release available since 10 months here: http://pecl.php.net/package/uploadprogress

http://fisheye.liip.ch/changelog/PUB/misc/uploadprogress?cs=8276

Motin, 27.10.2007 12:55 CEST

Oh sorry, I was mistaken about the cause (I read above about it as "the explanation" but didn't double check it sorry). It's just that the extension clearly doesn't work at all when Suhosin is enabled. The /tmp/php* file steadily increases in size, the form was supplied with the following:

<form method="POST" enctype="multipart/form-data">


but uploadprogress_get_info('472314fb68c45'); returns NULL during the whole upload.

Same issue as in my earlier comments above. I am using uploadprogress 0.3.1-dev and php 5.2.1 with apc 3.0.13.

It it's not the security issue - what is it then?

Motin, 27.10.2007 12:57 CEST

Comment system stripped out the input - the code should be (trying with htmlentities...):
<form method="POST" enctype="multipart/form-data">
<input type="hidden" name="UPLOAD_IDENTIFIER" value="472314fb68c45">

testebr, 26.11.2007 08:51 CEST

where can we found some proper documentation about how is this extension supposed to work? The functions, etc..

Nathan, 10.01.2008 05:01 CEST

I have the script working great (and am really happy with it), but I'm having troubles uploading large files... Once the file hits around 50MB, I get an "Invalid Meter ID" error. All of the php.ini settings are for 1GB.

I need to have the script supporting uploads of up to 700-800MB...

Anyone have any ideas?

Richard Leblanc, 19.02.2008 18:59 CEST

I have been using this script for a client who needs to have a dump site. The client base is mostly graphic artists who require file uploads in excess of 200 megs. A few changes required in php.ini to deal with file upload size. Posted example of php.ini in upload.tar.gz. Go to the url posted and download upload.tar.gz. Place user1 folder in html directory to access from your url. eg."youcanddns.com/user1". If unable to do so you can setup a ddns site at home using noip.com free ddns web address. eg. "youcanddns.no-ip.com. The url posted is a small linux home server so please keep file uploads under 5 megs. The example php.ini is setup to handle file uploads up to 1200 megs. Edit all 3 index files to suit your url "name" and alter necessary permissions.
Add index.php to "DirectoryIndex" section of apache.conf or httpd.conf. Edit .htaccess and .htpasswd to change password and user.
Fedora Core 8 with all yum updates.
Clone machine, Athalon 3.2 gig 1000meg ram

youcanddns.com/user1
user - guest1
password - elvis1

Richard Leblanc, 19.02.2008 19:21 CEST

Sorry I haven't played around with this thing for so long I forgot their is a cgi-bin element involved. Added cgi.tar.gz to site for use as example. You must edit XUploadConfig.pm to suit you're setup

Some Guy, 03.03.2008 14:13 CEST

Nathan, check your web server's settings as well, as a file limit could be set there.

Rob, 10.03.2008 21:07 CEST

For people using Windows that get no data from the uploadprogress_get_info function, make SURE you add the following to your php.ini.

uploadprogress.file.filename_template = "C:winnttempupload_prog_%s.txt"

Change the path accordingly to your temp directory.

neetesh bhatia, 16.03.2008 17:14 CEST

Hi All

Can u pls help me in configuing it
http://php5.bluga.net/UploadProgressMeter/demo.php
When i m downloading all source files and uploading it on my server its not working.
I noticed that in demoserver.php line no 20 it requires 'HTML/AJAX/Server.php' file(require_once 'HTML/AJAX/Server.php').

I browsed the SVN but not found this file.
Can anyone pls guide me from where i will get Server.php files

Thanks a lot in advance

Neetesh Bhatia
(nee_bhatia@yahoo.com)

Hermawan Haryanto, 17.03.2008 20:23 CEST

My server API is using CGI and also I use Zend Optimizer. Is it conflict with this extension? Coz I don't get it work. The function uploadprogress_get_info is not returning anything.

Hermawan Haryanto, 28.03.2008 20:57 CEST

I finally get it back to work, but not using this extension. I use a perl script to handle the upload and using AJAX to do another call to monitor the progress of that Perl script. Drop me email to hermawanharyanto@gmail.com if you need more advice.

Jerome, 07.04.2008 15:45 CEST

Hi,

just tried to use suhosin together with uploadprogressmeter and even with latest cvs build it not creating any tmp upt_*.txt file.
Using Debien etch php-5.2.0+etch10 with php5-suhosin package from apt-get.

No evidence in the suhosin logs...

Thanks for your help.

Pierre, 08.04.2008 15:19 CEST

I've spent several hours as well to wonder why the upt_*.txt files are not created.
Actually, they ARE...
But they are deleted when the upload is completed.
if ( event == MULTIPART_EVENT_END )
VCWD_UNLINK( progress->identifier );
So when the upload is fast, you don't see the file. If you want the file to stay (and since they are small and in the tmp folder, they could stay) then remove the call to UNLINK and recompile.

Jerome, 08.04.2008 17:56 CEST

@Pierre : I know were to look and especially when. I've tried while uploading files of 100MB and I do see the upt* file when suhosin is disabled. I just do not see it when suhosin is enabled.

Adrian, 12.04.2008 23:14 CEST

Hi,

Same here with latest CVS upload progress (downloaded today) and suhosin patch
on Apache-2.2.4 + PHP-5.2.4 + Suhosion-0.9.20.
The /tmp files are not created, if i disable
suhosin it works ok.

Sunnysven, 16.04.2008 12:05 CEST

That's a great extension!!!

Robin, 01.05.2008 22:29 CEST

This is really a great extension. But I found a problem.

While on all browsers it works
on IE7 in Windows VISTA

uploadprogress_get_info()

returns 0

I hope this can be fixed..

Chregu, 01.05.2008 22:33 CEST

This extension, like everything PHP related, is not dependent on the browser you use. The error must be somewhere else

sin, 07.05.2008 13:47 CEST

Thanks a lot for this great extension, I just figured out I needed this implementation in a site of mine yesterday, and guess what? I installed the PECL extension with only one try and it seems to work perfectly, looking forward to modifying the source for personal use :) Keep up the great work, Chregu, Doru and Joshua! :)

sin, 07.05.2008 19:06 CEST

By the way, Chregu and all the others, do you by any chance know a way of finding the GET query string of the HTTP request inside the uploadprogress_php_rfc1867_file function? I'd like to implement a way of getting UPLOAD_IDENTIFIER from the GET data on my own ;)

Toumal, 04.07.2008 18:20 CEST

I have the same problem as Hermawan Haryanto: the get_info function doesn't return anything at all. The only thing that's special about my setup is that I am using PHP in a FastCGI setup.

Hermawan Haryanto, 04.07.2008 20:13 CEST

Mr. Toumal, since we are using FastCGI, every request by browser is having it's own thread on the server. That's what makes the function get_info returning nothing. This extension is requesting that all request by single browser is having the same thread on the server.

It's not appropriate if I give you a different approach on this comments box since it will be out of topic. Please mail me to get more info on how to get it done.

Chregu, 04.07.2008 21:11 CEST

The "different threads" explanation is not true. The extension writes the temporary info into the filesystem and not into memory. So it's somehow true, that all the request have to go to servers which use the same filesystem for making it work, but certainly not have use the same thread. Otherwise with a pre-forking system like one usually uses in apache with php, it would never work.

Maybe it does really not work on FastCGi for other reasons, I never tested it, but the "threads-story" is just wrong.

Hermawan Haryanto, 04.07.2008 21:42 CEST

That's the conclusion that I got coz I saw the threads are all differs for each requests.

Just a suggestion, Is it possible if this extension using the same approach as the perl one does?

Chregu, 04.07.2008 21:52 CEST

And what's the approach of the perl one?

Hermawan Haryanto, 04.07.2008 22:07 CEST

1. On the HTML form, we give a unique ID on a hidden form field.
2. The extension then take that unique ID and generate a txt file on the temporary directory.
3. Meanwhile accepting the upload, the extension is updating that text file every few milliseconds with two colums (coma or pipe separated) containing the current received on the memory and the total size of the file.
4. After the file is uploaded completely, then save the file to the destination and remove the text file.

By using that approach, we can use another AJAX call to monitor the text file and doing our own display by using the information given on that text file.

What dya say?

Chregu, 05.07.2008 09:31 CEST

That's exactly how the extension does it... The upload process writes that file defined in uploadprogress.file.filename_template, a second process with uploadprogress_get_info() reads it and returns the data.

Please get a little bit more informed, before making such false assumptions :)

Hermawan Haryanto, 06.07.2008 17:52 CEST

:) Then I have no idea what else to say why does the uploadprogress_get_info() doesn't return anything on FastCGI installation and I know I'm not the only one who experience it.

If you have spare time, maybe you can test it too on FastCGI installation so you can see it. Perhaps, once you see it, you know why it behave like that.

You were saying "uploadprogress_get_info() reads it and returns the data". Would you care to share where does that function read on the filesystem? I mean what temporary file(s) to read? Maybe we could manually use built-in PHP method to read that file if that's the problem.

I desperately want to use this extension since I don't want to have my site having combination of both language Perl and PHP.

Thanks for the help man and sorry for the trouble.

Chregu, 07.07.2008 08:38 CEST

I doubt, it's the file reading, which causes the problem, but more the uploading itself. But for what it's worth:

The filename is defined in the ini variable uploadprogress.file.filename_template, which is by default /tmp/upt_%s.txt, where %s is the id sent in the UPLOAD_IDENTIFIER field.

hSATAC, 10.07.2008 09:18 CEST

Hi!I was using APC to handle my upload progress. But I found out that APC doesn't support multiple users! It means when there's another user trying to upload, the first user's progress bar will be disabled.

I would love to know could this uploadprogress extension be using in multiple users situation? thx a lot if someone tell me the answer.

Chregu, 10.07.2008 10:49 CEST

Yes, it can handle multiple users... But I'd be surprised if APC really has a problem with that...

waza123, 24.07.2008 17:39 CEST

im using lighttpd+php5.2.5 (fast cgi) , and function: uploadprogress_get_info() do not return any thing..

Pelle, 10.08.2008 12:42 CEST

Doesn't work on my box too. Must be the problem with suhosin mentioned above. The function always returns NULL. I'm btw running 5.2.0-8+etch11 on a debian 4.0 box with suhosin v0.9.12 and uploadprogress 0.9 (php info says it's 0.3.1-dev tho)

chregu, 12.08.2008 13:01 CEST

Pelle: Yes, it doesn't currently work with suhosin. I found the issue in suhosin. I contacted the authors there and I hope, they can adjust it, so it does the same as PHP without suhosin does.

And yes, I forgot to bump up the version number in one file, will soon be fixed

alex, 12.08.2008 13:14 CEST

Peopel, you can get progress metter in web server: Lighttpd version 1.5 from SVN.

MM, 27.08.2008 15:57 CEST

nice work, but I got the same problem with Fastcgi too.. what can I do?

Joseph Crawford, 03.09.2008 16:27 CEST

I just tried to upload a 30MB MP4 file and this is what I got as a result.

Upload succeeded, it took 64.382 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...

Chregu, 03.09.2008 16:30 CEST

And? "Maybe it really does not work..." :)

Joseph Crawford, 03.09.2008 16:35 CEST

that's why I was posting it. It says maybe it does not work. Is this something that does not work any longer or is this demo just broken?

Chregu, 03.09.2008 16:40 CEST

Ah, you used the demo :) Your file was too large. upload_max_filesize is 20MB (I will add that info to the demo...)

Joseph Crawford, 03.09.2008 16:53 CEST

Thanks for the tip, I used a file < 20MB and it worked fine. Does this use the same size limitations that PHP limits? I mean if we upped the size to 200MB, would this require it's own limit set or does it piggyback php's settings?

Chregu, 03.09.2008 17:02 CEST

Yes, it uses the php.ini settings

MM, 03.09.2008 17:05 CEST

It isn't important what size I am using (php ini 150MB), it jumps to 100% after finish..

Pete, 23.10.2008 22:36 CEST

I'm trying to compile uploadprogress.c via gcc on linux and get the following error:

--

In file included from uploadprogress.c:24:
/usr/local/include/php/main/rfc1867.h:74: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before âintâ

--

Anyone seen this before or know what to do?

Pet, 24.10.2008 17:18 CEST

nevermind... got it working

dropchew, 31.10.2008 18:27 CEST

I just tried to upload a 256KB MP4 file and this is what I got as a result.

Upload succeeded, it took 6.145 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...

My max upload filesize is 20MB, I am getting a headache over this lol...

Franc, 09.12.2008 11:58 CEST

Thanks for the work done.

I have a problem on my system.
uploadprogress_get_info() returns always NULL.

Is that a problem of installation ?
A known bug for which there is no answer yet ?

Any idea of how I could change that. I would be so gratefull. I am using it on an Apache2 running on a Debian etch with php5

Andreas, 21.12.2008 00:41 CEST

Download started since 52.104 seconds. No progress info yet

Demo(http://labs.liip.ch/uploadprogresssimple/index.php) is not worked for me.

chregu, 21.12.2008 09:22 CEST

Hi

Your file was maybe too large, then this happens. I'll try to look into that soon, but until then, that's a little flaw in uploadprogress

Chris, 10.01.2009 11:53 CEST

Hi, I am trying to compile php 5.2.8 on win64 (see phpx64 project on the net) and except a few extensions it works.

Unfortunately, in my setup "make" will not even try to build uploadprogress (latest from pecl) since there is no config.w32; I tried to adapt a config file from tokenizer:
---------
// $Id: config.w32,v 1.1.6.1 2007/08/01 15:13:40 pajoye Exp $
// vim:ft=javascript

ARG_ENABLE("uploadprogress", "PECL Upload Progress extension", "no");

if (PHP_UPLOADPROGRESS != "no") {
EXTENSION("uploadprogress", "uploadprogress.c");
AC_DEFINE("HAVE_UPLOADPROGRESS", 1);
}
---------

however, I will not see any output regarding uploadprogress in nmake's messages, configured for snapshot build.

Also I noticed that in the makefile it creates an output file "php_uploadprogress.dll"; in earlier x86 versions it was "uploadprogress.dll".

Can somebody help me with that?

Thanks, Chris

Tsengtan Adam Shuy, 26.01.2009 22:49 CEST

I had the same problem as Franc @ 09.12.2008 10:58 CET

Joust, 09.02.2009 13:55 CEST

It DOESN'T work with multiple uploads. If you want to track multiple files beeing uploaded by one user, the second upload will return NULL!

Wasted time :(

Any ideas?

Chregu, 09.02.2009 14:05 CEST

Joust: I don't see, how that technically could happen if you use different UPLOAD_IDENTIFIER ids.

Are you sure you use different UPLOAD_IDENTIFIER ids for the two uploads?

Joust, 09.02.2009 18:00 CEST

That's true. Different identifiers, but module creates only the first /tmp/upt* file and the second upload is not monitored...

Chregu, 09.02.2009 18:23 CEST

Joust: Are you using mod_php with Apache? And which apache module are you using?

Joust, 09.02.2009 21:48 CEST

PHP Version 5.2.6, Server API: Apache 2.0 Handler, Apache 2.2.9 on Linux 2.6.26.6, module 0.9.2 dl and compiled directly from PECL.
Thanks for your time :) You can email me if it's more convenient for you.

EricT, 28.02.2009 16:14 CEST

In all the demos I've found online and my own code, the meter shows 'waiting to upload' throughout the upload and then jumps straight to 'Upload complete' when I reset the cookie at the end of the upload.

uploadprogress_get_info() always returns NULL, so the actual progress is not shown. Can confirm that the temporary progress file gets created and sometimes deleted, sometimes not, at the end of the upload.

Using Apache 2.2.9, php 5.2.6.

Cheers,
eric t.

EricT, 28.02.2009 16:17 CEST

... on a Windows Vista system, that is.

John, 19.03.2009 01:02 CEST

1. Is there any way to tell uploadprogress_get_info() to check a directory other than /tmp? We are using nginx to load balance and it distributes the file uplods to /tmp/0 through /tmp/9 on a random basis. The problem is that uploadprogress_get_info() only checks upload_tmp_dir, which happens to be /tmp. Anyone know how a workaround besides updating the PECL code?

2. Does this work with suhosin yet?

Chregu, 31.03.2009 15:55 CEST

John: uploadprogress_get_info() puts its own files into tmp and doesn't need the uploaded files, so this has not much to do with each other.

The main issue is more, that maybe it doesn't work with nginx at all, but I didn't test it.

2. It works with suhosin since the August release of suhosin.

See also my latest blogpost at http://liip.to/X0 for more info about some common issues

Joust, 31.03.2009 16:21 CEST

... and it still won't do multiple simultaneous files from the same session...

Chregu, 31.03.2009 16:36 CEST

Joust: Please send me the smallest possible code you can reproduce that (or even better open a bug at http://pecl.php.net/bugs/report.php?package=uploadprogress ) I still can't see, how you run into that problem.

Did you also read the section "The position and content of UPLOAD_IDENTIFIER within the form is important" in http://liip.to/X0 ?

saji, 01.06.2009 07:17 CEST

From where i get code without patch

Chregu, 02.06.2009 08:59 CEST

Saji: You don't need to patch anything anymore if you have PHP 5.2

guruyaya, 20.10.2009 11:35 CEST

IMPORTANT!
After hours of struggle, I've found that this extention does not work well if apc.rfc1867 is on. Can anyone confirm my findings?

wasim, 07.06.2010 13:08 CEST

awesome work.Was looking for upload meter for last 2 hours.This one is great

Rick, 23.06.2010 12:58 CEST

I kept a backup of a working html folder on fedora 8 and 10. All you need to change are the url's on one file and install php. Modifications to php.ini and http.conf are included in the backup. In the middle of a move right now. Will post at youcanddns.no-ip.com
ASAP.

Jerry, 30.06.2010 08:35 CEST

Is there a tutorial on how to install this. I feel pretty lost without a step by step tutorial but i really would need this module. Can I load it without recompiling, reinstalling Php??

Stephan, 23.12.2010 16:04 CEST

Uploadprogress just does not work with FastCGI, even no workaround possible.

Since 2008 no solution, see:

Bug #14400 with php FastCGI do not work >>> http://pecl.php.net/bugs/bug.php?id=14400

HWK, 16.04.2011 23:05 CEST

APC_UPLOAD_PROGRESS must be defined before the type="file" input, else it won't work!!

Add a comment

Your email adress will never be published. Comment spam will be deleted!