How to set a value to a file input in HTML?

前端 未结 8 1953
天命终不由人
天命终不由人 2020-11-21 04:45

How can I set the value of this?


8条回答
  •  无人及你
    2020-11-21 05:29

    Actually we can do it. we can set the file value default by using webbrowser control in c# using FormToMultipartPostData Library.We have to download and include this Library in our project. Webbrowser enables the user to navigate Web pages inside form. Once the web page loaded , the script inside the webBrowser1_DocumentCompleted will be executed. So,

    private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
           FormToMultipartPostData postData = 
                new FormToMultipartPostData(webBrowser1, form);
            postData.SetFile("fileField", @"C:\windows\win.ini");
            postData.Submit();
        }
    

    Refer the below link for downloading and complete reference.

    https://www.codeproject.com/Articles/28917/Setting-a-file-to-upload-inside-the-WebBrowser-com

提交回复
热议问题