Sorry all,

I found the problem.  I had put in an entry in post_max_size as "2G"
however PHP seems to think that meant 2 bytes.  I lowered it down to
something reasonable in "M" and it worked fine.  I'm not sure if that is
a bug or not regardless of whether or not 2G is smart for that variable,
it took it as 2 bytes either way.

Cheers,

J.


-----Original Message-----
From: Jason Bennett [mailto:[EMAIL PROTECTED] 
Sent: Saturday, February 26, 2005 11:05 PM
To: php-general@lists.php.net
Subject: [PHP] Uploading a File

Hi all,

I'm having this problem trying to upload a file using PHP.  I am using
Apache (compiled from source) and PHP 5.0.3

The entire contents of the page is:

<form method="post" enctype="multipart/form-data" action="/upload.php">
<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="52428800">
<input type="file" name="myfile">
<input type="submit" value="Begin Upload">
</form>


The entire script is:

<?php

$uploaddir = "/tmp";
$uploadfile = $uploaddir . "uploaded.file";

if (move_uploaded_file($_FILES['myfile']['tmp_name'], $uploadfile))
{
  echo "Complete.";
}
else
{
   echo "No Upload.";
}

?>


The returned message I get is:

Notice: Undefined index: myfile in /www/htdocs/upload.php on line 6
No Upload.


I've checked $_FILES['myfile']['error'] and its empty.  The whole
$_FILES array is empty.  In my php.ini file I have the following:


; 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 = 50M

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to