Re: How to set value of <INPUT type=file...> element programmatically?
From: Shiva (shiva_sm_at_online.excite.com)
Date: 08/18/04
- Next message: Jeff Louie: "Re: Why no public qualified interface implementations?"
- Previous message: Nurchi BECHED: "Re: Line break in a windows application"
- In reply to: Evgeny Zoldin: "How to set value of <INPUT type=file...> element programmatically?"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 18 Aug 2004 10:47:17 +0530
Hi,
It can't be done programmatically; user has to manually select the file for
uploading.
"Evgeny Zoldin" <zoldin@hotmail.com> wrote in message
news:#vzad1JhEHA.3632@TK2MSFTNGP09.phx.gbl...
Hi ALL.
I need to simulate send POST data ( - file upload) as it was submitted in
Browser. In C# I create instanse of IE, navigate to page with the form, fill
in the fields and try to Submit by call submitButton.click() Unfortunately
it does not work while file_filed.vale = <path_to_file> has no effect, value
<INPUT type=file...> cound not be set from script of that HTML page. Is
there another way to set that value by means of .NET ? Below the part of
code :
SHDocVw.InternetExplorer ie = new SHDocVw.InternetExplorerClass();
object o = null;
ie.Navigate( url, ref o, ref o, ref o, ref o ); // navigate to page with the
form and waiting for DownloadComplete
.............................................
mshtml.HTMLDocument doc = (mshtml.HTMLDocument)ie.Document;
mshtml.IHTMLInputFileElement file =
(mshtml.IHTMLInputFileElement)doc.getElementsByName("file").item(null,0);
file.value = m_sPathToFile; // has no effect!!!!!!!
mshtml.HTMLInputButtonElement btn =
(mshtml.HTMLInputButtonElement)doc.getElementsByName("send").item(null,0);
btn.click();
........................
Thank you for any help
Evgeny
- Next message: Jeff Louie: "Re: Why no public qualified interface implementations?"
- Previous message: Nurchi BECHED: "Re: Line break in a windows application"
- In reply to: Evgeny Zoldin: "How to set value of <INPUT type=file...> element programmatically?"
- Messages sorted by: [ date ] [ thread ]