PHP auto global variables inside C extension

php.internals

Arjun Jain

21 years ago
Hi everyone, I was wondering if there was any way in which the PHP auto global variables could be used inside the C extension code? Where does php store all the global variables? Well what I am trying to do is put the uploaded file in a custom database. But for that I require all the four paramaters, viz |$_FILES['userfile']['name'], ||$_FILES['userfile']['type'], ||$_FILES['userfile']['size'] and| |$_FILES['userfile']['tmp_name']|. So, instead of the user having to pass all this from php as function arguments, is there no way i can get these directly? Inside the extension code? Thanking you in advance. Regards aj http://arjun.notlong.com

Kamesh Jayachandran

21 years ago
SG(rfc1867_uploaded_files) will have a list of filenames uploaded. With regards Kamesh Jayachandran On Tue, 22 Mar 2005 12:32:44 +0530, "Arjun Jain" <arjun@picorp.com> said:

Zeev Suraski

21 years ago
At 09:02 22/03/2005, Arjun Jain wrote:
>Hi everyone, > >I was wondering if there was any way in which the PHP auto global >variables could be used inside the C extension code? Where does php store >all the global variables?
It stores them in the globals hash table. Take a look at php_session_start() in ext/session/session.c, and look for "_COOKIE", for an example of how you can access these. Once you have a reference to the $_FILES hash, you can iterate it to get each file (which is also a hash), and then lookup each element to obtain its value. Zeev