I have a function that uploads a file onto the server but it doesn't work. It always returns "There was an error processing your request, please try again." Can anyone tell me why it might not work?
Thanks in advance,
Juke
Function listed below:
//upload post function
function uploadPost()
{
$loc = $_POST['loc'];
if( move_uploaded_file( $_FILES['fileUp']['tmp_name'], "uploads/$loc/".basename($_FILES['fileUp']['name']) ) )
{
$this->message2 = "File uploaded.";
}
else
{
switch( $_FILES['fileUp']['error'] )
{
case 1:
case 2:
$this->message2 = "Your file could not be uploaded because:<br>The file has exceeded the maximum file size limit.";
break;
case 3:
$this->message2 = "Your file could not be uploaded because:<br>The file was only partially uploaded.";
break;
case 4:
$this->message2 = "Your file could not be uploaded because:<br>The File was not uploaded.";
break;
case 5:
$this->message2 = "Your file could not be uploaded because:<br>An unknown error occured.";
break;
default:
$this->message2 = "There was an error processing your request, please try again.";
break;
}
$this->message2 .= "<br>The file ". basename( $_FILES['fileUp']['name'])." has been uploaded";
}
}