Upload progress

php.internals

steve roussey

20 years ago
We do a "web 2.0" type upload, and show a spinner. When the file is large or the connection slow, people sometimes abort thinking that there was a problem. I'd like to show a progress bar. Is this possible yet? Which version? I can't use perl on these servers (PHP only), so I'm SOL. I've used a patch before, but a client does not want to use a hacked up PHP on production servers.

Evert Pot

20 years ago
Easiest way to go would then be flash or a java applet.. all the other methods i can think of are either php extensions or perl.. steve wrote:

Robert Amos

20 years ago
Or a lovely javascript concoction ;) -bok On 8/9/06, Evert Pot <evert@filemobile.com> wrote:
> > Easiest way to go would then be flash or a java applet.. all the other > methods i can think of are either php extensions or perl.. > > steve wrote: > > We do a "web 2.0" type upload, and show a spinner. When the file is > > large or the connection slow, people sometimes abort thinking that > > there was a problem. I'd like to show a progress bar. Is this possible > > yet? Which version? I can't use perl on these servers (PHP only), so > > I'm SOL. I've used a patch before, but a client does not want to use a > > hacked up PHP on production servers. > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >
-- Xnyo - http://xnyo.odynia.org/

Unknown W. Brackets

20 years ago
How is that? You can't get any feedback from PHP (except, now, by installing/writing an extension) about how far along the upload is - no matter how much JavaScript you use. And the browser won't tell you. Some people have scanned the /tmp directory for possible PHP uploads, but this obviously doesn't work even a bit for concurrent users. -[Unknown] -------- Original Message --------

Rasmus Lerdorf

20 years ago
The patch to support this is in PHP 5.2 CVS now. Unknown W. Brackets wrote:

Unknown W. Brackets

20 years ago
I had thought that was only for extensions; is there something in the userspace too (without writing/installing an extension)? Thanks, -[Unknown] -------- Original Message --------

steve roussey

20 years ago
Thanks Rasmus, that is great to hear. At some point in the past, it required a patch in PHP itself as well a extenstion. Is this still the case? I'd like to try it out with 5.2RC2 but can't find docs. Sorry to bring up an old thead, I was out of town. -s On 8/9/06, Rasmus Lerdorf <rasmus@lerdorf.com> wrote:

Markus Fischer

20 years ago
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, steve wrote:
> Thanks Rasmus, that is great to hear. At some point in the past, it > required a patch in PHP itself as well a extenstion. Is this still the > case? I'd like to try it out with 5.2RC2 but can't find docs.
Correct me if I'm wrong but I think that the current implementation are still the groundwork and you need an extension which is not available out-of-the-box in PHP. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFE6p7w1nS0RcInK9ARAt/6AKC53/Epl9uJt/qq7zajMJFUXBd3+QCg1jlX 3AejVwAXi0kHuam0tBTXusk= =lCd7 -----END PGP SIGNATURE-----

steve roussey

20 years ago
On 8/21/06, Markus Fischer <markus@fischer.name> wrote:
> Correct me if I'm wrong but I think that the current implementation are > still the groundwork and you need an extension which is not available > out-of-the-box in PHP.
Perhaps the other extension could be ported to support the new hooks, and added to pecl. I just put in on my todo list to check it out.

Arpad Ray

20 years ago
If you set post_max_size to 0, you can parse the post data yourself from php://input. Combine that with the Content-Length value from apache_request_headers() and you have everything you need for a progress monitor. I don't mean to detract from the hopefully soon-to-come support in the core, just to point out that it's already possible without a patch. I have some code using this method in case anyone's interested, email me off-list. Arpad Unknown W. Brackets wrote:

William A. Rowe, Jr.

20 years ago
Arpad Ray wrote:
> If you set post_max_size to 0, you can parse the post data yourself from > php://input. Combine that with the Content-Length value from > apache_request_headers() and you have everything you need for a progress > monitor.
Of course - this is entirely irrelevant if the client uses Transfer-Encoding: chunked, in which case you better ignore Content-Length if the client (or middle proxies) provided one. And if you don't grok this, you'd better search for the Watchfire Report on HTTP Request / Response Spoofing vulnerabilities before creating yet another vulnerable server app.

Unknown W. Brackets

20 years ago
Fair enough. I was under the (now obviously wrong) impression that setting post_max_size to 0 wouldn't let me get to the post data. But that's still setting you dependent on it being Apache. I would need (if I were to add this feature to any of my software) to write this in code that can run on IIS or as CGI (because it is intended for end-users.) Very interesting. Thank you, -[Unknown] -------- Original Message --------