public function profilePictureUploader($aFormValues){
// Retrieve from Registry
$ttNameSpace = Zend_Registry::get('ttNameSpace');
$userManager = Zend_Registry::get('userManager');
$user = $ttNameSpace->user;
// Get the image
$image = $_FILES['picture'];
$pictureID = $userManager->retrieveNextPictureID($user);
// Sort out the file extension
$type = $image['type'];
switch ($type){
case 'image/jpeg':
$extension = ".jpg";
case 'image/jpg':
$extension = ".jpg";
case 'image/png':
$extension = ".png";
}
$destination = "images/profiles/picture_" . $user->user_id . "-" . $pictureID . $extension;
if(move_uploaded_file($image['tmp_name'], $destination)){
chmod($destination, 0755);
// Now add picture to the user's data in the db
$userManager->insertUserProfilePicture($user, $destination);
}
$this->_xajaxResponse->alert('yay!');
$this->_xajaxResponse->assign("results","innerHTML","woohooo! it works! this is a standard xajax response containing \n<pre>\$_FILES:\n ".print_r($_FILES,true)."\nAND formvalues:\n".print_r($aFormValues,true)."</pre>" );
return $this->_xajaxResponse;
}