|
|
@@ -273,6 +273,7 @@ namespace Learun.Application.Web.Controllers |
|
|
|
UserInfo userInfo = LoginUserInfo.Get(); |
|
|
|
|
|
|
|
string FileEextension = Path.GetExtension(files[0].FileName); |
|
|
|
if (FileEextension.ToLower() != ".png" && FileEextension.ToLower() != ".jpg") return Fail("只可上传JPG、PNG格式的图片"); |
|
|
|
string filePath = Config.GetValue("AnnexesFile"); |
|
|
|
string uploadDate = DateTime.Now.ToString("yyyyMMdd"); |
|
|
|
string fileGuid = Guid.NewGuid().ToString(); |
|
|
@@ -285,12 +286,41 @@ namespace Learun.Application.Web.Controllers |
|
|
|
Directory.CreateDirectory(path); |
|
|
|
files[0].SaveAs(fullFileName); |
|
|
|
|
|
|
|
UserEntity userEntity = new UserEntity(); |
|
|
|
userEntity.F_UserId = userInfo.userId; |
|
|
|
userEntity.F_Account = userInfo.account; |
|
|
|
userEntity.F_HeadIcon = saveFileName; |
|
|
|
userIBLL.SaveEntity(userEntity.F_UserId, userEntity); |
|
|
|
return Success("上传成功。"); |
|
|
|
var fs = new System.IO.FileStream(fullFileName, System.IO.FileMode.Open, System.IO.FileAccess.Read); |
|
|
|
var r = new System.IO.BinaryReader(fs); |
|
|
|
string fileclass = ""; |
|
|
|
byte buffer; |
|
|
|
try |
|
|
|
{ |
|
|
|
buffer = r.ReadByte(); |
|
|
|
fileclass = buffer.ToString(); |
|
|
|
buffer = r.ReadByte(); |
|
|
|
fileclass += buffer.ToString(); |
|
|
|
|
|
|
|
} |
|
|
|
catch |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
r.Close(); |
|
|
|
fs.Close(); |
|
|
|
if (fileclass == "255216" || fileclass == "13780")//说明255216是jpg;7173是gif;6677是BMP,13780是PNG;7790是exe,8297是rar |
|
|
|
{ |
|
|
|
UserEntity userEntity = new UserEntity(); |
|
|
|
userEntity.F_UserId = userInfo.userId; |
|
|
|
userEntity.F_Account = userInfo.account; |
|
|
|
userEntity.F_HeadIcon = saveFileName; |
|
|
|
userIBLL.SaveEntity(userEntity.F_UserId, userEntity); |
|
|
|
return Success("上传成功。"); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
System.IO.File.Delete(fullFileName); |
|
|
|
return Fail("只可上传JPG、PNG格式的图片"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 验证旧密码 |
|
|
|