如何使用Asp.net将单个文件复制到单个目录 [英] How to Copy Single file into Single directory using Asp.net

查看:106
本文介绍了如何使用Asp.net将单个文件复制到单个目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用Asp.net将单个文件复制到单个目录中

How to Copy Single file into Single directory using Asp.net

推荐答案

System.IO.File.Copy("C:\File.txt","D:\dic\File.txt")


在上面的示例中,将file.txt复制到Dic目录.

当您在ASP.NET中使用 System.IO.File.Copy 时.
请记住,您正在处理不在客户端上的Server文件.
如果需要复制客户端文件,请使用Javascript.


In above example file.txt copied to Dic directory.

When u use System.IO.File.Copy in ASP.NET.
remember you are deal with files of Server not on client.
If you need to copy client files then use Javascript.


^ ].




使用此代码通过编码复制单个文件

Hi,

Use this code for copying single file through coding

protected void Button1_Click(object sender, EventArgs e)
{
    File.Copy(Server.MapPath("~/Images/Sunset.jpg"), Server.MapPath("~/testingimages") + "/" + "Sunset.jpg");
}



这里''m将日落图像从Images文件夹复制到testingimages文件夹.


我希望你能理解我说的话

最好的



Here ''m copying sunset image from Images folder to testingimages folder.


I hope you understood What I said

All the Best


这篇关于如何使用Asp.net将单个文件复制到单个目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆