DirectoryInfo dir = new DirectoryInfo(AppContext.BaseDirectory); var path = dir.FullName + @"tempFile\"; var filePath = path + Guid.NewGuid() + fileNa... ...
DirectoryInfo dir = new DirectoryInfo(AppContext.BaseDirectory); var path = dir.FullName + @"tempFile\"; var filePath = path + Guid.NewGuid() + fileName; if (!Directory.Exists(path)) Directory.CreateDirectory(path); using (WebClient client = new WebClient()) { // address:從中下載數據的 URI,www.xxxx.com/xx.jpg // filePath:從中下載數據的 URI,C:\\tempFile\\xx.jpg client.DownloadFile(address, filePath); }