简体   繁体   中英

How to download a file to a specific folder?

I want to download a file to a specific folder. I'm using WebClient.DownloadFile , but what I would like is to let the user select where this file would be saved, not just download it into any folder.

How can I do this?

The folder that the user would download the file to would depend on their browser, and system settings.

All you can do is provide the file to download, and it would be up to them (and their browser) to select a local folder (on their system).

If you want to control that process, you would have to use an embedded plugin like Java, Silverlight, Flash, etc.

如果使用的是Windows Forms,则可以使用SaveFileDialog类允许用户选择文件名,然后将该名称传递给WebClient.DownloadFile的第二个参数。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM