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.getElementsByNam e("file").item(null,0);
file.value = m_sPathToFile; // has no effect!!!!!!!
mshtml.HTMLInputButtonElement btn = (mshtml.HTMLInputButtonElement)doc.getElementsByNa me("send").item(null,0);
btn.click();
.........................
Thank you for any help
Evgeny 2 28328
"Evgeny Zoldin" <zo****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl 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 ?
There is no way to set the value programmatically, with .NET or
otherwise, for security reasons. value property on <input type="file">
element is read-only.
--
With best wishes,
Igor Tandetnik
"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken
Hi,
It can't be done programmatically; user has to manually select the file for
uploading.
"Evgeny Zoldin" <zo****@hotmail.com> wrote in message
news:#v**************@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.getElementsByNam e("file").item(null,0);
file.value = m_sPathToFile; // has no effect!!!!!!!
mshtml.HTMLInputButtonElement btn =
(mshtml.HTMLInputButtonElement)doc.getElementsByNa me("send").item(null,0);
btn.click();
.........................
Thank you for any help
Evgeny This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: chirs |
last post by:
Hi,
I want to put a value in a cookie. The following code does not work.
It does not store the box1.value in the cookie. How can I fix it?
<input type="text" name="box1"...
|
by: Martin Lucas-Smith |
last post by:
I am wanting to know whether are XHTML1-valid characters for use
within an id attribute and/or a name attribute.
...
|
by: not 2 swift |
last post by:
I thought I would update an old page on which I had used a
<INPUT TYPE=image ...>
with a
<BUTTON><IMG SRC=...></BUTTON>
The problem is that <BUTTON> always provides a shadow/emboss effect.
Can...
|
by: iinet |
last post by:
How can i set in my css a min width for input elements, but leave the max
size dynamic?
Ben
|
by: TR |
last post by:
Is it possible with CSS to prevent this wrapping alignment with a checkbox
with a nested label?
This is the label of the
checkbox that wraps beneath it
I'd prefer it looked like...
| |
by: Brian Henry |
last post by:
Hi, I am having a problem with an attachment system I made... it works with
files up to ~3MB in size then after that if you try to upload a file it just
goes to a "Page can not be displayed" page...
|
by: Bart van Deenen |
last post by:
Hi all
I have a form with a couple of input fields, embedded within spans. I am
using script.aculo.us for dragging and dropping, and want to reorder the
input fields that way. The input fields are...
|
by: Mara Guida |
last post by:
Hi,
After I've populated a page with some <INPUT ...> elements I'd like to
have access to whatever is written there.
The best I've done (which does not work) is:
================
//...
|
by: JPhilS |
last post by:
Hi to all Webmaster!
I have discover this problem when I inserted the scores of the students i a centain subject.
I am making a school project with regards to saving students' record.
first, I...
|
by: test9991014 |
last post by:
Hi folks,
I've got something like this:
<table>
<tr>
<td>1</td>
<td align=center>
<input type=text>
</td>
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |