Welcome! Log In Create A New Profile

Advanced

php apache_request_headers() replicement?

Hüseyin Mert
August 09, 2010 06:30AM
Hello,
I'm developing a xhr uploading script by using
http://github.com/valums/file-uploader
But nginx has no apache_request_headers function, and find from php.net an
replicement.


function _apache_request_headers() {
foreach($_SERVER as $key=>$value) {
if (substr($key,0,5)=="HTTP_") {
$key=str_replace(" ","-",ucwords(strtolower(str_replace("_","
",substr($key,5)))));
$out[$key]=$value;
}
}
return $out;
}

my problem is that upload script has following function that needs a
content-lenght param which nginx does not have


function getSize(){
$headers = *apache_request_headers*();
return (int)*$headers['Content-Length']*;
}


so I add an extra param to my site config


fastcgi_param CONTENT-LENGTH $content_length;



this parameter is needed for how much bytes uploaded to the server (maybe I
get it wrong) , how can I fix this issue? Thanks for all..

--
Hüseyin Mert
http://www.hmert.com
_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

php apache_request_headers() replicement?

Hüseyin Mert August 09, 2010 06:30AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 143
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready