To upload a file into your web server, you need to create a directory where your files should reside. It should not be a directory where you store your php, html, css, etc files. Assign write all permissions to the directory. In Unix:
mkdir uploads
chmod 777 uploads
The next step is to create an HTML form
<html>
<body>
<form enctype="multipart/form-data" action="getfile.php" method="POST">
Please upload your dta file: <input name="uploaded" type="file" /><br />
<input type="submit" value="Upload" />
</form>
</body>
</html>
Save this file as form.php
The next step is to create an upload file as follows:
<?php
$target = "uploads/";
$target = $target . basename( $_FILES['uploaded']['name']) ;
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']). " is uploaded";
} else {
echo "Could not upload your file.";
}
?>
Name this file getfile.php and run main.php. That'a all!