I've written a script with help from the examples here to upload a file
This works fine on one server, but I get 403 errors when I try it on another server, even with files as small as 1K
the folder 'data' is chmodded to 766
any ideas?
<?php
$path = $_SERVER['DOCUMENT_ROOT']."/data/";
$maxsize = 1000000;
$filesize = $_FILES['userfile']['size'];
$filetype = $_FILES['userfile']['type'];
// check file arrived OK
if (is_uploaded_file($_FILES['userfile']['tmp_name']))
{
//check file size
if($filesize>=$maxsize)
{
echo"file to large";
exit;
}
//check file type
if(($filetype!="image/gif")
AND ($filetype!="application/pdf")
AND ($filetype!="image/pjpeg")
AND ($filetype!="application/msword"))
{
echo "Wrong Document Type ".$filetype;
exit;
}
//copy file to data folder with its original name
copy($_FILES['userfile']['tmp_name'], $path.$_FILES['userfile']['name']);
echo "<BR>";
echo "File Uploaded";
}
?>