string path = Path.GetDirectoryName(Application.ExecutablePath) +
"\\" + directores[directores.Length - 2] +
"\\" + Path.GetFileName(url_img).Replace(" ", "_");
client.DownloadFileAsync(new Uri(url_img), path);
此代碼在不工作的路徑似乎是很好,當我通過MessageBox的檢查:C#DownloadFileAsync,不以絕對路徑工作
我也曾嘗試與@
符號,但它不起作用。
如果我輸入的不是路徑,但一個名字,e.g
client.DownloadFileAsync(new Uri(url_img), "test");
一切正常。我該如何解決這個問題?
忘了補充:如果這樣的路徑不存在,我想創建它!
你是什麼意思的「不工作」。你有什麼異常? – 2015-02-11 09:02:48
不,沒有例外,但它也不保存文件。 – Qentinios 2015-02-11 09:04:06
嘗試其他路徑,即'c:\ test'; Offtopic:使用「Debug.Print」而不是MessageBox作爲診斷消息。 – i486 2015-02-11 09:15:24