were those two sections in the same file? "entire contents" and
"entire script" can be a bit unclear. if they are in the same file...
u might want to put an
if (!empty($_FILES['myfile']['name'])) {
//second section that handles files upload
// the $uploaddir = "/tmp"; part
}
it would be good to give ur submit button a name:
<input type="submit" name="submit_button_name" value="Begin Upload">
...so u can use it as
if (isset($_POST['submit_button_name'])) {
// 2nd section as above
}
On Sat, 26 Feb 2005 23:04:59 -0700, Jason Bennett <[EMAIL PROTECTED]> wrote:
> 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
>
--
]#
Anirudh Dutt
...pilot of the storm who leaves no trace
like thoughts inside a dream
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php