I have this major problem with my upload script. It works perfectly on my personal server and uploads to what ever directory I state but when I run it on other servers it refuses to upload. I have made sure that the php.ini files has the correct settings.
Any help will be appreciated!
Here is the script I have used.
Form
<form enctype="multipart/form-data" action="upload.php" method="POST">
SELECT A FILE:<input name="userfile" type="file">
<input type="submit" value="UPLOAD"><br/>
</form>
Script
<?php
$loc = "./files/";
include("common.inc");
error_reporting(0);
//Full file path
$uploadfile = $loc. $_FILES['userfile']['name'];
echo "File: ";
echo $uploadfile;
//if file is greater than 2MB do not upload and send error message
if (($_FILES['userfile']['size']) > $max)
{
printf("<br><br><b> Error: File size is greater than 2 megabytes</b><br/>");
exit;
}
//upload file status and file details
print "<pre>";
if (move_uploaded_file($FILES['userfile']['tmp_name'], $uploadfile))
{
print "File is valid, and was successfully uploaded. ";
print "Here's some more debugging info:\n";
print_r($FILES);
}
else
{
print "Unable to upload File! Here's some debugging info:\n";
print_r($_FILES);
}
?>