Forum Moderators: coopster
I'm having a small problem. I've made few tests for PHP upload and using the files below:
The PHP file (test.php):
<?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"];
}
?>
The HTML file
<html>
<body>
<form action="test.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>
I've chmod'ed the php file to 755, nothing is uploaded on the TMP folder (where I understand the files are uploaded).
Am I doing something wrong?
Thank you,
xt35
P.S. I'm using a Linux webhosting on Hostgator.
The file will be deleted from the temporary directory at the end of the request if it has not been moved away or renamed.
[php.net...]
You should be moving it appropriately to the location of your choice.
Warning: move_uploaded_file(/public_html/aatest/AFile.txt) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/auser/public_html/aatest/test3.php on line 9
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpAQu8qN' to '/public_html/aatest/AFile.txt' in /home/auser/public_html/aatest/test3.php on line 9