lundi 6 avril 2015

C# - Upload File to Website


Vote count:

0




There's an input tag on a website that I want to programmatically upload an image file to. The tag looks like this:



<input type="file" label="upload" ..>


I don't know how to interact with something like this. How would I input a specified image file to that tag?


I have this much:



OpenFileDialog ofd = new OpenFileDialog();
ofd.Title = "Choose Images";
ofd.Filter = "Image files (*.jpg, *.jpeg, *.jpe, *.jfif, *.png) | *.jpg; *.jpeg; *.jpe; *.jfif; *.png";
if (ofd.ShowDialog() == DialogResult.OK)
{
HtmlElementCollection elc = wb.Document.GetElementsByTagName("input");
Image i = Image.FromFile(ofd.FileName);
foreach (HtmlElement el in elc)
{
//Upload file here
}
}


asked 32 secs ago







C# - Upload File to Website

Aucun commentaire:

Enregistrer un commentaire