Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
How to do the question above, I will also need to delete the old image.
Below find the delete area of the function, this does not delete the file.
string OldIMGId = memb.MemberProperties.Find(x => x.Alias == "profilePic").Value.ToString(); if (OldIMGId != null && OldIMGId != "") { _mediaService.Delete(Umbraco.Media(OldIMGId)); }
Below find the update image bit, 'pic' is HttpPostedFileBase type, memb is an umbraco MemberProfile type.
var media = _mediaService.CreateMedia(pic.FileName, folder.Id, "Image"); media.SetValue(Constants.Conventions.Media.File, pic); _mediaService.Save(media); memb.MemberProperties.Find(x => x.Alias == "profilePic").Value = media.Id; Members.UpdateMemberProfile(memb);
Could someone explian how to do this please?
Ok turns out my methods were working for the save.
Had to upload the [sitename].dll file to the server as the changes I made were in the controller.
Delete is still not working though, I will repost as a separate q.,
le-sigh...
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Update the image on a member profile programmatically
How to do the question above, I will also need to delete the old image.
Below find the delete area of the function, this does not delete the file.
Below find the update image bit, 'pic' is HttpPostedFileBase type, memb is an umbraco MemberProfile type.
Could someone explian how to do this please?
Ok turns out my methods were working for the save.
Had to upload the [sitename].dll file to the server as the changes I made were in the controller.
Delete is still not working though, I will repost as a separate q.,
le-sigh...
is working on a reply...