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

Search Discussions

  • Evert Pot at Aug 8, 2006 at 11:38 pm
    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.
  • Robert Amos at Aug 9, 2006 at 2:56 am
    Or a lovely javascript concoction ;)

    -bok
    On 8/9/06, Evert Pot 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 at Aug 9, 2006 at 2:54 pm
    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
    On 8/9/06, Evert Pot 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
  • Rasmus Lerdorf at Aug 9, 2006 at 3:17 pm
    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.
  • Unknown W. Brackets at Aug 10, 2006 at 4:29 am
    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:
    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.
  • Steve at Aug 21, 2006 at 10:35 pm
    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 wrote:
    The patch to support this is in PHP 5.2 CVS now.
  • Markus Fischer at Aug 22, 2006 at 6:26 am
    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.
  • Steve at Aug 23, 2006 at 2:17 am

    On 8/21/06, Markus Fischer 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 at Aug 9, 2006 at 3:19 pm
    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 --------

    Or a lovely javascript concoction ;)

    -bok
    On 8/9/06, Evert Pot 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
  • William A. Rowe, Jr. at Aug 9, 2006 at 5:39 pm

    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 at Aug 10, 2006 at 4:45 am
    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
  • Arpad Ray at Aug 11, 2006 at 10:27 am

    Unknown W. Brackets wrote:
    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.
    Of course then $_POST isn't available, so if you want to handle normal
    POST data in the same request it also has to be manually parsed. I use
    an .htaccess file to limit this to the one file handling these requests.
    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.)
    I believe you could use $_SERVER/$_ENV['CONTENT_LENGTH'] in CGI, I don't
    know about the IIS ISAPI module though.

    Arpad
  • Richard Quadling at Aug 11, 2006 at 12:55 pm

    On 11/08/06, Arpad Ray wrote:
    Unknown W. Brackets wrote:
    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.
    Of course then $_POST isn't available, so if you want to handle normal
    POST data in the same request it also has to be manually parsed. I use
    an .htaccess file to limit this to the one file handling these requests.
    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.)
    I believe you could use $_SERVER/$_ENV['CONTENT_LENGTH'] in CGI, I don't
    know about the IIS ISAPI module though.

    Arpad

    --
    PHP Internals - PHP Runtime Development Mailing List
    To unsubscribe, visit: http://www.php.net/unsub.php
    If I set Windows ISAPI's post_max_size to 0 bytes, I get ...

    Warning: POST Content-Length of 9261 bytes exceeds the limit of 0
    bytes in Unknown on line 0

    My handler is <?php phpinfo(); ?>. There is no need to actually handle
    the upload.

    and

    _SERVER["CONTENT_LENGTH"] 9261
    _SERVER["CONTENT_TYPE"] multipart/form-data;
    boundary=---------------------------1753618095350
    _SERVER["HTTP_CONTENT_LENGTH"] 9261
    _SERVER["HTTP_CONTENT_TYPE"] multipart/form-data;
    boundary=---------------------------1753618095350

    But even with ...

    always_populate_raw_post_data On

    I get ...

    Notice: Undefined variable: HTTP_RAW_POST_DATA (for
    $HTTP_RAW_POST_DATA) and Notice: Undefined index: HTTP_RAW_POST_DATA
    (for $_SERVER['HTTP_RAW_POST_DATA']).


    Assuming you CAN get the length, it may be that you cannot actually
    get the data.


    --
    -----
    Richard Quadling
    Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&amp;r=213474731
    "Standing on the shoulders of some very clever giants!"
  • Unknown W. Brackets at Aug 11, 2006 at 2:28 pm
    Using PHP 5.1.x (I don't remember which exact version) I tested opening
    php://input (since I want to stream it anyway) the other day - and that
    did work.

    I think I may have had display_errors off on that box, though, so I may
    have missed this warning you mention.

    -[Unknown]
    -------- Original Message --------

    If I set Windows ISAPI's post_max_size to 0 bytes, I get ...

    Warning: POST Content-Length of 9261 bytes exceeds the limit of 0
    bytes in Unknown on line 0

    My handler is <?php phpinfo(); ?>. There is no need to actually handle
    the upload.

    and

    _SERVER["CONTENT_LENGTH"] 9261
    _SERVER["CONTENT_TYPE"] multipart/form-data;
    boundary=---------------------------1753618095350
    _SERVER["HTTP_CONTENT_LENGTH"] 9261
    _SERVER["HTTP_CONTENT_TYPE"] multipart/form-data;
    boundary=---------------------------1753618095350

    But even with ...

    always_populate_raw_post_data On

    I get ...

    Notice: Undefined variable: HTTP_RAW_POST_DATA (for
    $HTTP_RAW_POST_DATA) and Notice: Undefined index: HTTP_RAW_POST_DATA
    (for $_SERVER['HTTP_RAW_POST_DATA']).


    Assuming you CAN get the length, it may be that you cannot actually
    get the data.
  • Arpad Ray at Aug 11, 2006 at 8:16 pm

    Richard Quadling wrote:
    But even with ...

    always_populate_raw_post_data On

    I get ...

    Notice: Undefined variable: HTTP_RAW_POST_DATA (for
    $HTTP_RAW_POST_DATA) and Notice: Undefined index: HTTP_RAW_POST_DATA
    (for $_SERVER['HTTP_RAW_POST_DATA']).


    Assuming you CAN get the length, it may be that you cannot actually
    get the data.
    Have you tried reading from php://input? Having it all in
    HTTP_RAW_POST_DATA implies it has all been read at once anyway.

    The content-length warning is AFAIK unavoidable. I mentioned before that
    I use an .htaccess file to set post_max_size just for that script - I
    also set error_reporting there to suppress the warning.

    I suggest we move this discussion to php-general anyway, since we're no
    longer talking about internals.

    Arpad
  • Unknown W. Brackets at Aug 11, 2006 at 2:26 pm
    What about Transfer-Encoding, as mentioned in another post? I didn't
    think PHP provides that one.

    -[Unknown]
    -------- Original Message --------

    I believe you could use $_SERVER/$_ENV['CONTENT_LENGTH'] in CGI, I don't
    know about the IIS ISAPI module though.

    Arpad

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupphp-internals @
categoriesphp
postedAug 8, '06 at 11:09p
activeAug 23, '06 at 2:17a
posts17
users9
websitephp.net

People

Translate

site design / logo © 2022 Grokbase