Uploading a File

From: Date: Sun, 27 Feb 2005 06:04:59 +0000
Subject: Uploading a File
Groups: php.general 
Request: Send a blank email to php-general+get-209528@lists.php.net to get a copy of this message
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

« previous php.general (#209528) next »