问题描述
我正在尝试下面的代码,在远程服务器上传文档,但它显示错误
"给定不支持路径格式。"
using(WebClient client = new WebClient())
{
                  client.Credentials =新的NetworkCredential(用户名,密码);
             &NBSP ;    Directory.CreateDirectory(@" https://Sample.com/Folders/Test Folder /");
//此处显示错误
  ;              client.UploadFile(QUOT; HTTPS://Sample.com/Folders/Test文件夹/"," POST",@" C:\\Sample Document.docx");   &NBSP ;
}
如何使用webclient创建必要的目录?
-TIA
Hi,
I am trying with below code, to Upload a document in remote server, but it shows an Error"The given path's format is not supported."
using (WebClient client = new WebClient())
{
client.Credentials = new NetworkCredential(UserName, Password);
Directory.CreateDirectory(@"https://Sample.com/Folders/Test Folder/"); //Error shown here
client.UploadFile("https://Sample.com/Folders/Test Folder/", "POST" , @"C:\\Sample Document.docx");
}
How can I create the necessary directories with webclient ?
-TIA
这篇关于如何在上传文件时使用webclient创建目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!