I am trying to upload a file (an image) using the WebBrowser control. Can't seem to do it and need some help.
Here is the Html:
<form action="https://post.testsite.com/k/IOkurrwY4xGI_EJMbjF5pg/zMNsR" method="post" enctype="multipart/form-data">
<input type="hidden" name="cryptedStepCheck" value="U2FsdGVkX18yNzEwMjcxMJdrv2IidjtpGSCPzHNblWk02eJAJ6DFXFXic-Am1lTPMYL7k7XDoH0">
<input type="hidden" name="a" value="add">
<input class="file" type="file" name="file" multiple="multiple">
<button class="add" type="submit" name="go" value="add image">add image</button>
</form>
Here is the C# code...
elements = webBrowser.Document.GetElementsByTagName("input");
foreach (HtmlElement file in elements)
{
if (file.GetAttribute("name") == "file")
{
file.Focus();
file.InvokeMember("Click");
SendKeys.Send("C:\\Images\\CCPhotoID.jpg" + "{ENTER}");
}
}
Note that the file upload button comes up, but can't input any filename into the file name area.