コード例 #1
0
        public UploadFileInfo Upfile(IFormFile file)
        {
            if (file is null)
            {
                throw new ArgumentNullException(nameof(file));
            }
            string webFile = $"~/wwwroot/UploadFiles/{Guid.NewGuid().ToString()}";

            return(UploadFileHandle.UploadImage(webFile, file));
        }
コード例 #2
0
        public ResultView SetHeadImg(string employeeId, Microsoft.AspNetCore.Http.IFormFile imageFile)
        {
            string         webFile = $"~/wwwroot/UploadFiles/Employee/Head/{employeeId}/{Guid.NewGuid().ToString()}";
            UploadFileInfo file    = UploadFileHandle.UploadImage(webFile, imageFile);

            var info = _Service._SearchById(employeeId);

            UploadFileHandle.Delete(info.HeadImg);
            info.HeadImg = file.WebFileName;
            _Service.Update(info, LogonInfo);
            return(ResultView.Success("头像修改成功"));
        }