$_FILES is empty. Tried EVERYTHING.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Bog
Forum Newbie
Posts: 2
Joined: Tue Feb 17, 2004 6:18 pm

$_FILES is empty. Tried EVERYTHING.

Post by Bog »

All I did was recompile my PHP 4.3.4 with the included GD and now
$_FILES is perpetually empty. I tried recompiling again
without GD to fix the problem, to go back to what I had before, but
$_FILES is always empty. I am running Mandrake 9.2 - this is like the ONLY thing I've installed on it besides vnc, apache2 and mysql 4.

Here is how I ran configure:
[root@localhost php-4.3.4]# ./configure
--with-apxs2=/usr/local/apache2/bin/apxs --with-mysql
--prefix=/usr/local/php434 --with-gd (also tried without gd again)

Here is what I'm using to test fix attempts:

<?
error_reporting(E_ALL);
print_r($_FILES);
if (empty($_FILES)) {
echo "\$_FILES is empty<br>\n"; //this prints
}
echo $_FILES['player1photo']['error']; //$_FILES is empty anyway.
echo '<form method="POST" enctype="multipart/form-data">
<input type="file" name="player1photo"
accept="image/gif;image/jpeg"/>
<input type="submit"/></form>';

//echo phpinfo();
?>

and here is the relevant portion of my php.ini (and yes, I've tried
channging upload_tmp_dir to a dir that is 777. No good. (and why
should I have to anyway, it worked before)).
;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;

; Whether to allow HTTP file uploads.
file_uploads = On

; Temporary directory for HTTP uploaded files (will use system default
if not
; specified).
;upload_tmp_dir =/tmp

; Maximum allowed size for uploaded files.
upload_max_filesize = 2M

Here's the perms on /tmp:
drwxrwxrwt 11 root root 4096 Feb 17 18:48 tmp/

I even tried recompiling apache and then php again, again. I also tried "--without-pear". WHY WHY WHY WHY WTF?
User avatar
Michael 01
Forum Commoner
Posts: 87
Joined: Wed Feb 04, 2004 12:26 am

Post by Michael 01 »

If you are trying to upload, you need a temp directory to temporarily store the uploads in. This particular case, this line is commented out:

Temporary directory for HTTP uploaded files (will use system default
if not
; specified).
;upload_tmp_dir =/tmp
You will want to uncomment that line like so:

Temporary directory for HTTP uploaded files (will use system default
if not
; specified).
upload_tmp_dir =/tmp
It may be a system default in the wrong directory, so try uncommenting for craps and giggles.
Bog
Forum Newbie
Posts: 2
Joined: Tue Feb 17, 2004 6:18 pm

Post by Bog »

Thanks, but as I said in my original post, I already tried that:

[quote="Bog"]
and here is the relevant portion of my php.ini (and yes, I've tried
channging upload_tmp_dir to a dir that is 777. No good. (and why
should I have to anyway, it worked before)).
[quote]

But thanks for responding anyway. I added the semicolon back in again because that's how it *used to* work.

Anyone else?
Post Reply