Browse Source

复制文件时覆盖原有文件

develop-FileUpload-test
胡超1 2 years ago
parent
commit
42d7c3770c
  1. 18
      24Hour/Controllers/Common/LawyerArchivesController.cs

18
24Hour/Controllers/Common/LawyerArchivesController.cs

@ -2009,7 +2009,7 @@ namespace _24Hour.Controllers.Common
if (System.IO.File.Exists(filepath))
{
var targetfile = Path.Combine(annecdir, Path.GetFileName(filepath));
System.IO.File.Copy(filepath, targetfile,true);
System.IO.File.Copy(filepath, targetfile, true);
}
}
@ -2024,7 +2024,7 @@ namespace _24Hour.Controllers.Common
if (System.IO.File.Exists(filepath))
{
var targetfile = Path.Combine(legalAidPhotoDir, Path.GetFileName(filepath));
System.IO.File.Copy(filepath, targetfile,true);
System.IO.File.Copy(filepath, targetfile, true);
}
}
@ -2038,7 +2038,7 @@ namespace _24Hour.Controllers.Common
if (System.IO.File.Exists(filepath))
{
var targetfile = Path.Combine(legalAidPhotoDir, Path.GetFileName(filepath));
System.IO.File.Copy(filepath, targetfile,true);
System.IO.File.Copy(filepath, targetfile, true);
}
}
var otherPhotos = item.otherPhoto.ConvertToModel<List<string>>() ?? new List<string>();
@ -2050,7 +2050,7 @@ namespace _24Hour.Controllers.Common
if (System.IO.File.Exists(filepath))
{
var targetfile = Path.Combine(legalAidPhotoDir, Path.GetFileName(filepath));
System.IO.File.Copy(filepath, targetfile,true);
System.IO.File.Copy(filepath, targetfile, true);
}
}
@ -2062,7 +2062,7 @@ namespace _24Hour.Controllers.Common
var userdir = Path.Combine(packegdir, "users", item.cardId);
//保存身份证图片
var cardids = item.cardIdphoto.ConvertToModel<List<string>>();
var cardids = item.cardIdphoto.ConvertToModel<List<string>>() ?? new List<string>();
var cardidDir = Path.Combine(userdir, "cardids");
if (Directory.Exists(cardidDir) == false) Directory.CreateDirectory(cardidDir);
foreach (var file in cardids)
@ -2070,7 +2070,7 @@ namespace _24Hour.Controllers.Common
var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + file.Replace("/", @"\");
if (System.IO.File.Exists(filepath))
{
System.IO.File.Copy(filepath, Path.Combine(cardidDir, Path.GetFileName(filepath)),true);
System.IO.File.Copy(filepath, Path.Combine(cardidDir, Path.GetFileName(filepath)), true);
}
}
//保存工作证图片 律师职业证书
@ -2082,7 +2082,7 @@ namespace _24Hour.Controllers.Common
var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + file.Replace("/", @"\");
if (System.IO.File.Exists(filepath))
{
System.IO.File.Copy(filepath, Path.Combine(identityphotosDir, Path.GetFileName(filepath)),true);
System.IO.File.Copy(filepath, Path.Combine(identityphotosDir, Path.GetFileName(filepath)), true);
}
}
@ -2094,7 +2094,7 @@ namespace _24Hour.Controllers.Common
var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + file.Replace("/", @"\");
if (System.IO.File.Exists(filepath))
{
System.IO.File.Copy(filepath, Path.Combine(departmentPhotosDir, Path.GetFileName(filepath)),true);
System.IO.File.Copy(filepath, Path.Combine(departmentPhotosDir, Path.GetFileName(filepath)), true);
}
}
}
@ -2105,7 +2105,7 @@ namespace _24Hour.Controllers.Common
FileInfo fi = new FileInfo(packegzipname); //xx/xx/aa.rar
var akspath = System.IO.Path.ChangeExtension(packegzipname, ".aks");
fi.MoveTo(akspath,true); //xx/xx/xx.rar
fi.MoveTo(akspath, true); //xx/xx/xx.rar
FileInfo fimoved = new FileInfo(akspath);
result.result = fimoved.FullName;
result.IsSucceed = true;

Loading…
Cancel
Save