我需要將C:/ images文件夾中的圖像複製到我在服務器中運行的Web應用程序文件夾中。我使用了以下在本地應用程序中運行良好的代碼但在服務器在asp.net中將本地機器的圖像複製到服務器C#
string sourcePath = @"D:\images";
//string destinationPath = @"D:\a";
string destinationPath = Server.MapPath("SMSImages") + "\\";
if (System.IO.Directory.Exists(sourcePath))
{
string[] files = System.IO.Directory.GetFiles(sourcePath);
foreach (string s in files)
{
fileName = Path.GetFileName(s);
destFile = Path.Combine(destinationPath, fileName);
File.Copy(s, destFile, true);
}
如何複製
它是如何工作的?你有任何錯誤?還是該副本什麼都不做? –