# PHP auto global variables inside C extension

- Thread: https://externals.io/message/15531
- Original archive: https://news-web.php.net/php.internals/15531
- Started by Arjun Jain on 2005-03-22T07:02:44+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #15531 — Arjun Jain — 2005-03-22T07:02:44+00:00

URL: https://externals.io/message/15531#15531

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

---

## #15532 — Kamesh Jayachandran — 2005-03-22T07:13:59+00:00

URL: https://externals.io/message/15531#15532 · In reply to: #15531

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:
> 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

---

## #15535 — Zeev Suraski — 2005-03-22T11:20:10+00:00

URL: https://externals.io/message/15531#15535 · In reply to: #15531

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
