How can I set the value of this?
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
1) The problem of default value in a file input IS NOT "done for security reasons", but the browsers "just failed to implement it, for no good reason": see this deep report
2) A simple solution can be to use a text input on top of file input, like here. Of course you need some code to send the file, using now the value in text input and not the file input.
In my case, doing HTA application, that is not a problem, I don't use form at all.