作者snk521 (哇哈哈)
看板C_Sharp
标题[问题] 关於WebClient UploadFile (WindowsForm)
时间Thu Jul 26 15:55:37 2012
小弟我是使用Windows Form C++ 语法。在使用WebClient 的FileUpload功能时出现
类型 'System.Net.WebException' 的未处理例外状况发生於 System.dll
其他资讯: 远端伺服器传回一个错误: (417) Expectation Failed。
上网Google过,网上写说只要多加一行
ServicePointManager.Expect100Continue = false
即可解决,但是我加了以後还是有同样的问题,想请问还有什麽方法可以解决这样
的情况吗?
[ Part Source Code ]
ServicePointManager::Expect100Continue = false;
WebClient^ MywebClient = gcnew WebClient;
String^ URL = "网址";
String^ FilePath = "档案路径";
if ( !File::Exists( FilePath ) )
{
showlog("IPK does not exist !");
return Fail;
}
array<Byte>^responseArray = MywebClient->UploadFile( URL , FilePath );
我的档案大小只有2KB,想请问有可能是档案类型有限制吗?
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 210.61.29.25