Are you referencing $fileParts
before it is defined?
$targetFile = $uploadDir .$_POST['user_id']. '-profile.'. strtolower($fileParts['extension']);
// Validate the filetype
$fileParts = pathinfo($_FILES['Filedata']['name']);
should be
$fileParts = pathinfo($_FILES['Filedata']['name']);
$targetFile = $uploadDir .$_POST['user_id']. '-profile.'. strtolower($fileParts['extension']);
// Validate the filetype