I'm using this code to upload the user profile picture from a module:
public static void UpdateProfilePhoto(UserInfo user, string photoPath)
{
DotNetNuke.Services.FileSystem.IFolderInfo fi = DotNetNuke.Services.FileSystem.FolderManager.Instance.GetUserFolder(user);
DotNetNuke.Services.FileSystem.IFileInfo file;
using (FileStream localFileStream = new FileStream(photoPath, FileMode.Open))
{
file = DotNetNuke.Services.FileSystem.FileManager.Instance.AddFile(fi, "profilepicture" + user.UserID.ToString() + ".jpg", localFileStream);
user.Profile["Photo"] = file.FileId;
UserController.UpdateUser(user.PortalID, user);
}
}
but seems there's some caching problem around. Also I see that after uploading my picture I see a new one with "_xs" at the end.
What is the correct way of uploading a profile picture from a module so that we don't have these issues?