Upload user profile image from custom plugin controller Im trying to upload a profile image from a front end form via a controller function

this is what i have but the $image keeps returning null?

&lt;form name="updateProfile" method="post" enctype="multipart/form-data"&gt;
     &lt;input type="hidden" name="action" value="salesforce/saveContact"&gt;
     &lt;input type="file" name="photo" id="avatarUpload"&gt;
     &lt;input type="submit"/&gt;
&lt;/form&gt;


and my controller action is

public function actionSaveContact()
{

    $this-&gt;requirePostRequest();

    $userPhoto = craft()-&gt;request-&gt;getPost('photo');

    $user = craft()-&gt;userSession-&gt;getUser();

    craft()-&gt;users-&gt;saveUserPhoto('test.jpg',$userPhoto, $user);

}


Not sure what im doing wrong?
The image data is not going to be in POST variable. You should be using

$userPhoto = UploadedFile::getInstanceByName('userPhoto');