[問題] 關於WebClient UploadFile (WindowsForm)
小弟我是使用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
C_Sharp 近期熱門文章
PTT數位生活區 即時熱門文章