Download file and automatically save it to folder

后端 未结 6 647
夕颜
夕颜 2020-12-01 07:21

I\'m trying to make a UI for downloading files from my site. The site have zip-files and these need to be downloaded to the directory entered by the user. However, I can\'t

6条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-01 07:28

    A much simpler solution would be to download the file using Chrome. In this manner you don't have to manually click on the save button.

    using System;
    using System.Diagnostics;
    using System.ComponentModel;
    
    namespace MyProcessSample
    {
        class MyProcess
        {
            public static void Main()
            {
                Process myProcess = new Process();
                myProcess.Start("chrome.exe","http://www.com/newfile.zip");
            }
        }
    }
    

提交回复
热议问题