I have php code for simple file uploadings.
I have index.php with form

<form action="upload.php" method="post" ENCTYPE="multipart/from-data">
Choose file <input type="file" name="userfile" size="50"> <input type="submit" value="Upload">
</form>

and upload.php

<?php
$uploaddir = '/var/www/htdocs/upload/data/'
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);  *

if(is_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { *
  echo "file uploaded.";
} else {
  echo "upload unsuccessful!";
}

?>

It works. But it works only on konquerror. But not on firefox, MS IE or opera.

In apache log I get PHP Notice: Undefined index: userfile. in lines marked with *.

Recommended Answers

All 2 Replies

There is a typo in ENCTYPE. It should be form-data.

OOps.
Sorry :D
Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.