Hello Guys, I am creating profile edit form in front end, with Image upload field. Some design requirements stopped me from using Uploadfield as I am not very good at silverstripe. I am able to get up to following function i.e. I am receiving image in $data variable and can access it with $data['mf_file_dragndrop']. but I don't know how to handle uploaded image and update Member image. Can any one please help.
public function MemberImage($data){
$member = TeamMember::currentUser();
$up =new Upload();
$bUploadNew = false;
if (!empty($data['mf_file_dragndrop']['name']))
$bUploadNew = true;
if ($bUploadNew) {
$img = Object::create('Image');
$up->loadIntoFile($data['mf_file_dragndrop'], $img, 'Uploads');
//to do
// update member with new image and return image path so in profile new image can be displayed
}
}