i would try throwing $SERVER['DOCUMENT_ROOT'] in front of your $target_path. i would switch around your if/else for moving the uploaded file. i would write:
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file $fn has been uploaded";
} else {
echo "There was an error uploading the file, please try again!";
echo "ERROR: ". $_FILES['uploadedfile']['error'] . " (value between 1-4)";
}
move_uploaded_file will return false on failure, and checks to make sure that the file is a valid uploaded file.
do you have a form field that looks like this in your form?
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
(value is size in bytes)
that is the max_file_size that php is referring to in the manual, not the php.ini
an error of 1 would be a violation of the upload_max_filesize in php.ini, 2 is the max_file_size in the actual html form.
i would remove the spaces from your target path. looking throught the manual, i saw this:
Due to the large amount of directory listing styles we cannot guarantee that files with exotic names (like containing spaces) are handled properly.
the only other thing i would suggest, but i don't think is causing the error is to simplify the creation of the target path string. you can get the same result, but much easier to read, by using:
$target_path = "/a_random_path/pdfs/".time()."pdf";
hope something in here helps!