I am fairly familiar with PHP and have just recently got Apache and MySQL to work on Snow Leopard. My idea is to create a sort of "digital file cabinet" to manage PDFs for my home use. However, I have ran into a snag...
In researching how to upload files in PHP, I came across the following w3 website: PHP File Upload
After copying their exact code (minus the restriction part), my code is the following:
After I upload a file, my browser returns the following:
Upload: test.png
Type: image/png
Size: 92.7666015625 Kb
Temp File: /private/var/tmp/php6ZY6Ad
Warning: move_uploaded_file(upload/test.png): failed to open stream: Permission denied in /Users/jg/Sites/development/testing/upload_file.php on line 14 Warning: move_uploaded_file(): Unable to move '/private/var/tmp/php6ZY6Ad' to 'upload/test.png' in /Users/jg/Sites/development/testing/upload_file.php on line 14 Stored in: upload/test.png
I've hunted around on the web...but no one seems to have a the same problem...
In researching how to upload files in PHP, I came across the following w3 website: PHP File Upload
After copying their exact code (minus the restriction part), my code is the following:
Code:
<?php
//upload_file.php
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 />";
move_uploaded_file($_FILES["file"]["tmp_name"],
"upload/" . $_FILES["file"]["name"]);
echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
}
?>
After I upload a file, my browser returns the following:
Upload: test.png
Type: image/png
Size: 92.7666015625 Kb
Temp File: /private/var/tmp/php6ZY6Ad
Warning: move_uploaded_file(upload/test.png): failed to open stream: Permission denied in /Users/jg/Sites/development/testing/upload_file.php on line 14 Warning: move_uploaded_file(): Unable to move '/private/var/tmp/php6ZY6Ad' to 'upload/test.png' in /Users/jg/Sites/development/testing/upload_file.php on line 14 Stored in: upload/test.png
I've hunted around on the web...but no one seems to have a the same problem...