i am using mac os x 10.5 with apache php and mysql.
i tried below program but end up with following message..
Upload: insurance1.jpg
Type: image/jpeg
Size: 845.189453125 Kb
Temp file: /private/var/tmp/php0Vueol
Warning: move_uploaded_file(uploads/insurance1.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /Library/WebServer/Documents/php/upload_file.php on line 25
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/private/var/tmp/php0Vueol' to 'uploads/insurance1.jpg' in /Library/WebServer/Documents/php/upload_file.php on line 25
Stored in: uploads/insurance1.jpg
<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>
<?php
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 200000000))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_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 "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";
if (file_exists("uploads/" . $_FILES["file"]["name"]))
{
echo $_FILES["file"]["name"] . " already exists. ";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],
"uploads/" . $_FILES["file"]["name"]);
echo "Stored in: " . "uploads/" . $_FILES["file"]["name"];
}
}
}
else
{
echo "Invalid file";
}
?>
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>