uploading files through php-generated scripts
| From: | David P. Schwartz | Date: | Mon, 15 Jan 2001 20:19:05 +0000 |
| Subject: | uploading files through php-generated scripts | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-34658@lists.php.net to get a copy of this message | ||
I've got a strange thing with overriding an ini file in PHP.
I'm trying to implement a simple example of a script that allows a file to be
uploaded.
I put an <INPUT TYPE="file" NAME="myfile"
ENCTYPE="multipart/form-data"> tag
on the form, along with a submit button. (yeah, the rest of the HTML is
fine...)
The script gets the file, uploads it, and the $myfile variable says the
uploaded file is named something like "/var/tmp/phpq32345". However, I don't
have write permissions to /var/tmp. (Neither does the process doing the
actual upload!)
I created a php3.ini file in the same directory that contains the script.
It has only the line:
upload_tmp_dir = myuploads
Then I created a directory named myuploads in the same dir with 2777
perms.
However, the script never sees this ini file! I printed out the cwd from
the script, and it IS the same dir where the php3.ini file resides; I can
even exec a command 'ls -l *.ini' and it shows up there just fine.
I tried setting $PHPRC inside the script, but that doesn't work. I'm not sure
how to inject PHPRC into the php script environment, because the scripts run
as user "nobody".
I can't figure out how to override the default location. Any suggestions?
FYI: this is running on PHP 3.0.14, Apache 1.3.12 on a FreeBSD 4.0 platform.
-David Schwartz