Jukebox42 Posted March 27, 2007 Share Posted March 27, 2007 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"; } } Quote Link to comment https://forums.phpfreaks.com/topic/44439-solved-file-upload-function-not-working/ Share on other sites More sharing options...
hitman6003 Posted March 27, 2007 Share Posted March 27, 2007 Do you have the form encoding set correctly for your html form? http://us2.php.net/manual/en/features.file-upload.php Quote Link to comment https://forums.phpfreaks.com/topic/44439-solved-file-upload-function-not-working/#findComment-215820 Share on other sites More sharing options...
Jukebox42 Posted March 27, 2007 Author Share Posted March 27, 2007 that was exactly it thank you hitman6003 i knew it had to be something trivial. Quote Link to comment https://forums.phpfreaks.com/topic/44439-solved-file-upload-function-not-working/#findComment-215826 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.