110,536
社区成员
发帖
与我相关
我的任务
分享
string Allfilename = Request["value"].ToString();
string[] ss = Allfilename.Split(',');
string SchFilepath = ss[0];
string Filename=ss[1];
string serverpath = Server.MapPath("~/temp/NAME");
string Filepath = serverpath + @"\Schemaic File\"+PlaFilename;
File.Copy(SchFilename, Filepath, true);
string Allfilename = Request["value"].ToString();
string[] ss = Allfilename.Split(',');
string SchFilepath = ss[0];
string Filename=ss[1];
string serverpath = Server.MapPath("~/temp/NAME");
string Filepath = serverpath + @"\Schemaic File\"+PlaFilename;
File.Copy(SchFilename, SchFilepath, true);
using System;
using System.IO;
class Test
{
public static void Main()
{
string path = @"c:\temp\MyTest.txt";
string path2 = path + "temp";
try
{
using (FileStream fs = File.Create(path)) {}
// Ensure that the target does not exist.
File.Delete(path2);
// Copy the file.
File.Copy(path, path2);
Console.WriteLine("{0} copied to {1}", path, path2);
// Try to copy the same file again, which should fail.
File.Copy(path, path2);
Console.WriteLine("The second Copy operation succeeded, which was not expected.");
}
catch (Exception e)
{
Console.WriteLine("Double copying is not allowed, as expected.");
Console.WriteLine(e.ToString());
}
}
}