Search code examples
phptimeoutmetric

how to measure time to upload a file (from browser to server) in php from the server point of view?


Does php provide api to check multipart/form-data upload rate , or total duration ?

I also want to know how does PHP knows about various timeout events from IIS and php.ini settings ?


Solution

  • There's a value in $_SERVER you can check to find out when the request was initiated. From the PHP manual:

    'REQUEST_TIME' The timestamp of the start of the request. Available since PHP 5.1.0. It is float with microseconds since PHP 5.4.0.

    So you can compare $_SERVER ['REQUEST_TIME'] against the current time() with the proviso that you're limited to a resolution of 1 second until PHP 5.4 becomes widespread.