# Upload progress

- Thread: https://externals.io/message/25250
- Original archive: https://news-web.php.net/php.internals/25250
- Started by steve on 2006-08-08T22:29:09+00:00
- Messages: 12
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #25250 — steve — 2006-08-08T22:29:09+00:00

URL: https://externals.io/message/25250#25250

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.

---

## #25251 — Evert Pot — 2006-08-08T23:18:56+00:00

URL: https://externals.io/message/25250#25251 · In reply to: #25250

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.

---

## #25253 — Robert Amos — 2006-08-09T02:56:04+00:00

URL: https://externals.io/message/25250#25253 · In reply to: #25251

Or a lovely javascript concoction ;)

-bok


>
> 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:
> > […]
>
> --
> 
> 
>
>


-- 
Xnyo - http://xnyo.odynia.org/

---

## #25263 — Unknown W. Brackets — 2006-08-09T14:33:21+00:00

URL: https://externals.io/message/25250#25263 · In reply to: #25253

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 --------

> Or a lovely javascript concoction ;)
> 
> -bok
> 
> 
> > […]

---

## #25264 — Rasmus Lerdorf — 2006-08-09T14:57:38+00:00

URL: https://externals.io/message/25250#25264 · In reply to: #25263

The patch to support this is in PHP 5.2 CVS now.

Unknown W. Brackets wrote:
> 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.

---

## #25265 — Arpad Ray — 2006-08-09T15:18:28+00:00

URL: https://externals.io/message/25250#25265 · In reply to: #25263

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:
> 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 --------
>
> > […]

---

## #25271 — William A. Rowe — 2006-08-09T17:13:23+00:00

URL: https://externals.io/message/25250#25271 · In reply to: #25265

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.

---

## #25275 — Unknown W. Brackets — 2006-08-10T04:24:10+00:00

URL: https://externals.io/message/25250#25275 · In reply to: #25265

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 --------

> 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

---

## #25274 — Unknown W. Brackets — 2006-08-10T04:29:41+00:00

URL: https://externals.io/message/25250#25274 · In reply to: #25264

I had thought that was only for extensions; is there something in the 
userspace too (without writing/installing an extension)?

Thanks,
-[Unknown]

-------- Original Message --------

> The patch to support this is in PHP 5.2 CVS now.
> 
> Unknown W. Brackets wrote:
> > […]

---

## #25398 — steve — 2006-08-21T22:35:32+00:00

URL: https://externals.io/message/25250#25398 · In reply to: #25264

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


> The patch to support this is in PHP 5.2 CVS now.

---

## #25403 — Markus Fischer — 2006-08-22T06:06:40+00:00

URL: https://externals.io/message/25250#25403 · In reply to: #25398

-----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

---

## #25406 — steve — 2006-08-23T02:17:21+00:00

URL: https://externals.io/message/25250#25406 · In reply to: #25403

> 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.
