Hi,
I'm trying to learn how to create an upload file form. I'm stuck on a couple of things. This is something I learn in the past but I forgot how to create one, so it's new to me now. I got the script from http://www.w3schools.com/php/php_file_upload.asp
1) I want to learn how to upload a file to a specific folder but having an issue understanding how to do that.
2) How do I override a file that already exist in that folder.
Here is the Form file:
<html>
<body>
<form action="upload_file.php" method="post"
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<input type="submit" name="submit" value="Submit" />
</form>
</body>
</html>
Here is the Upload Script file
<?php
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "Stored in: " . $_FILES["file"]["tmp_name"];
}
?>
I really appreciate if someone explain to me how to write it correctly. Thanks!