Re: Upload progress

php.internals

Arpad Ray

20 years ago
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

20 years ago
On 11/08/06, Arpad Ray <arpad@rajeczy.com> 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

20 years ago
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 --------

Arpad Ray

20 years ago
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

20 years ago
What about Transfer-Encoding, as mentioned in another post? I didn't think PHP provides that one. -[Unknown] -------- Original Message --------