string path = @"c:\temp\MyTest.txt";
string path2 = path + "temp";
File.Copy(path, path2, true);path2 中+“temp"有什么作用
file.copy第二个参数说是不能为路径,为什么+"temp"后就可以了 , +temp 是什么意思
string path2 = path + "temp";
File.Copy(path, path2, true);path2 中+“temp"有什么作用
file.copy第二个参数说是不能为路径,为什么+"temp"后就可以了 , +temp 是什么意思
第二个参数就是路径啊,但是你如果写path,那岂不是和原文件重名了。
家temp的目的是改下扩展名,不让文件重名,不然你无法复制。path2="c:\\1.txt";
这样也是可以的
这不是怕文件名重复么,后面拼上一个 temp
OpenFileDialog openfile = new OpenFileDialog();openfile.Multiselect = true
openfile.Filter = "GeoMap图片|*.gdb|所有文件|*.*";
openfile.FilterIndex = 2;
openfile.Title = "选择上传图片";
string[] fd = openfile.FileNames;
for (int i = 0; i < openfile.FileNames.Length; i++)
{
FileInfo fi = new FileInfo(fd[i]);
if (fi.Exists)
fi.CopyTo(@"E:server\" + openfile.SafeFileName);
}
@"E:server\",,这个可以???应该是E:\server\吧