无法使用File.Copy复制文件 [英] can not copy file using File.Copy

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

问题描述

嗨!
我要将以下地址的文件复制到我的服务器.
我想复制此文件并保存在服务器上的文件夹中.

http:\\ 192.168.1.107 \ RecFolder \ 2012-09-14 04-29-24第4行,UP2

此路径给出错误.

不支持URI格式.

Hi!
I want to copy file following address to my server.
I want to copy this file and save in my folder on server.

http:\\192.168.1.107\RecFolder\2012-09-14 04-29-24 Line 4.UP2

this path gives error.

URI format not supported.

推荐答案

此功能不支持此类URI.它仅适用于本地计算机上安装的文件系统.如果文件位于使用文件共享协议为网络用户共享的目录中,并且此目录已安装在客户端计算机上,则文件本身可能在其他计算机上.不支持其他类型的协议(例如HTTP,FTP等).

要下载通过HTTP公开的文件,可以使用类System.Net.HttpWebRequest:
http://msdn.microsoft.com/en-us/library/system.net. httpwebrequest.aspx [ ^ ].

对于一个显示如何下载的示例,您可以使用我的应用程序HttpDownloaded张贴在这里:
如何从Internet下载文件 [ ^ ].

另请参阅我过去的答案:
如何从中下载文件Asp.net 2.0中的服务器 [
Such URIs are not supported by this function. It works only for the file systems mounted on the local computer. The files themselves could be on some other computer, if they are in the directory shared for the network users using file sharing protocols and this directory is mounted on a client computer. Other kinds of protocols (like HTTP, FTP and so on) are not supported.

To down load a file exposed via HTTP, you can use the class System.Net.HttpWebRequest:
http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx[^].

For one sample showing how to download, you can use my application HttpDownloaded posted here:
how to download a file from internet[^].

See also my past answer:
how to download a file from the server in Asp.net 2.0[^].

—SA


这篇关于无法使用File.Copy复制文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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