copy images from local machine to server in asp.net C#

Takka

New Member
I need to copy the images from C:/images folder to my web application folder which is running in the server.I used the following code which work well in local application but not work in server\[code\] 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); }\[/code\]how to copy
 
Back
Top