简体   繁体   中英

How do I download a file in a custom directory?

I googled it and no help. I am making a program here people register and then they can download some indie games i am creating. But i am having problems with the download function. When i go to download the game / program i am getting a error saying i need a file extension here is the code i am trying

My.Computer.Network.DownloadFile("https://www.dropbox.com/sh/yioya7ek0dq1r60/AABzT-98B4DWPdgv1edYC5SMa?dl=0", "C:\ProgramData\GamingcenterApp\games")

I need it to be like this because it is downloading a games folder that the gaming center will know it is installed so it can open the app.

Thanks GamingBlock

Let me explain what to do. DownloadFile downloads a file to your PC, and not a folder. Here is the fixed code:

My.Computer.Network.DownloadFile("C:\ProgramData\GamingcenterApp\games", "READ_ME.txt")

Folders are purposely not supposed to be downloaded by the DownloadFile call. I haven't tested your code but it could generate an exception.

Argument 1 is the file you want to download from the internet, and Arguement 2 is the file name. Not the directory you want it to download to. Also, You can't set the text in the .txt file by code. And of course this will generate an exception because I tested your code.

If this does not help, Simply comment on this answer and I will try to improve it.

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