Browse Source

copy时覆盖原文件

develop-FileUpload-test
胡超1 2 years ago
parent
commit
56bf39cf60
  1. 16
      24Hour/Controllers/Common/LawyerArchivesController.cs

16
24Hour/Controllers/Common/LawyerArchivesController.cs

@ -2008,7 +2008,7 @@ namespace _24Hour.Controllers.Common
if (System.IO.File.Exists(filepath)) if (System.IO.File.Exists(filepath))
{ {
var targetfile = Path.Combine(annecdir, Path.GetFileName(filepath)); var targetfile = Path.Combine(annecdir, Path.GetFileName(filepath));
System.IO.File.Copy(filepath, targetfile); System.IO.File.Copy(filepath, targetfile,true);
} }
} }
@ -2023,7 +2023,7 @@ namespace _24Hour.Controllers.Common
if (System.IO.File.Exists(filepath)) if (System.IO.File.Exists(filepath))
{ {
var targetfile = Path.Combine(legalAidPhotoDir, Path.GetFileName(filepath)); var targetfile = Path.Combine(legalAidPhotoDir, Path.GetFileName(filepath));
System.IO.File.Copy(filepath, targetfile); System.IO.File.Copy(filepath, targetfile,true);
} }
} }
@ -2037,7 +2037,7 @@ namespace _24Hour.Controllers.Common
if (System.IO.File.Exists(filepath)) if (System.IO.File.Exists(filepath))
{ {
var targetfile = Path.Combine(legalAidPhotoDir, Path.GetFileName(filepath)); var targetfile = Path.Combine(legalAidPhotoDir, Path.GetFileName(filepath));
System.IO.File.Copy(filepath, targetfile); System.IO.File.Copy(filepath, targetfile,true);
} }
} }
var otherPhotos = item.otherPhoto.ConvertToModel<List<string>>() ?? new List<string>(); var otherPhotos = item.otherPhoto.ConvertToModel<List<string>>() ?? new List<string>();
@ -2049,7 +2049,7 @@ namespace _24Hour.Controllers.Common
if (System.IO.File.Exists(filepath)) if (System.IO.File.Exists(filepath))
{ {
var targetfile = Path.Combine(legalAidPhotoDir, Path.GetFileName(filepath)); var targetfile = Path.Combine(legalAidPhotoDir, Path.GetFileName(filepath));
System.IO.File.Copy(filepath, targetfile); System.IO.File.Copy(filepath, targetfile,true);
} }
} }
@ -2069,7 +2069,7 @@ namespace _24Hour.Controllers.Common
var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + file.Replace("/", @"\"); var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + file.Replace("/", @"\");
if (System.IO.File.Exists(filepath)) if (System.IO.File.Exists(filepath))
{ {
System.IO.File.Copy(filepath, Path.Combine(cardidDir, Path.GetFileName(filepath))); System.IO.File.Copy(filepath, Path.Combine(cardidDir, Path.GetFileName(filepath)),true);
} }
} }
//保存工作证图片 律师职业证书 //保存工作证图片 律师职业证书
@ -2081,7 +2081,7 @@ namespace _24Hour.Controllers.Common
var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + file.Replace("/", @"\"); var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + file.Replace("/", @"\");
if (System.IO.File.Exists(filepath)) if (System.IO.File.Exists(filepath))
{ {
System.IO.File.Copy(filepath, Path.Combine(identityphotosDir, Path.GetFileName(filepath))); System.IO.File.Copy(filepath, Path.Combine(identityphotosDir, Path.GetFileName(filepath)),true);
} }
} }
@ -2093,7 +2093,7 @@ namespace _24Hour.Controllers.Common
var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + file.Replace("/", @"\"); var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + file.Replace("/", @"\");
if (System.IO.File.Exists(filepath)) if (System.IO.File.Exists(filepath))
{ {
System.IO.File.Copy(filepath, Path.Combine(departmentPhotosDir, Path.GetFileName(filepath))); System.IO.File.Copy(filepath, Path.Combine(departmentPhotosDir, Path.GetFileName(filepath)),true);
} }
} }
} }
@ -2104,7 +2104,7 @@ namespace _24Hour.Controllers.Common
FileInfo fi = new FileInfo(packegzipname); //xx/xx/aa.rar FileInfo fi = new FileInfo(packegzipname); //xx/xx/aa.rar
var akspath = System.IO.Path.ChangeExtension(packegzipname, ".aks"); var akspath = System.IO.Path.ChangeExtension(packegzipname, ".aks");
fi.MoveTo(akspath); //xx/xx/xx.rar fi.MoveTo(akspath,true); //xx/xx/xx.rar
result.result = $"/temp/{packegdirname}.aks"; result.result = $"/temp/{packegdirname}.aks";
result.IsSucceed = true; result.IsSucceed = true;

Loading…
Cancel
Save