Solved

webbrowser problem

Posted on 2001-06-03
8
215 Views
Last Modified: 2008-02-01
I hope someone out there is as twisted as me.

I know the webbrowser control pretty well. or so I thought until now.

<html>
<body>
<INPUT name=PICTURE1_SOURCE size=50 type=file accept="image/jpeg,image/jpg">
</body>
</html>

how do I programtically(from VB) set the value of this box. No .value does not work.



0
Comment
Question by:brookman
  • 4
  • 2
  • 2
8 Comments
 
LVL 5

Accepted Solution

by:
djbusychild earned 200 total points
ID: 6151646
this is really a VB question not a javascript question.

normally you wouldn't be able to since it'd be a security risk for javascript to set that and automatically upload random files from the user.


Now if you're overriding that through your own extended version of the webbrowser control, then you could try querying for the IHTMLDocument2 interface, then run get_forms on the interface, iterate through the IHTMLElementCollection interface you get back through the item() method until you find your file input then run set_value() on it... This is coming from the C++ point of view, I don't speak VB so this could potentially be a hell a lot easier through VB... dunno..

you might even be able to query for the IHTMLInputFileElement interface directly
0
 
LVL 5

Expert Comment

by:djbusychild
ID: 6151648
this is really a VB question not a javascript question.

normally you wouldn't be able to since it'd be a security risk for javascript to set that and automatically upload random files from the user.


Now if you're overriding that through your own extended version of the webbrowser control, then you could try querying for the IHTMLDocument2 interface, then run get_forms on the interface, iterate through the IHTMLElementCollection interface you get back through the item() method until you find your file input then run set_value() on it... This is coming from the C++ point of view, I don't speak VB so this could potentially be a hell a lot easier through VB... dunno..

you might even be able to query for the IHTMLInputFileElement interface directly
0
 
LVL 5

Expert Comment

by:djbusychild
ID: 6151649
oops... sorry I accidentally made that an answer. =(
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:VincentWong
ID: 6153062
This site is quite good. It provides whole source code of the file uploading function with comment. The whole function is written in VBScript and no need to register the com object.

I have used this before and it worked fine.

http://www.aspzone.com/articles/john/aspUpload/

good luck.
0
 
LVL 2

Expert Comment

by:VincentWong
ID: 6153106
You can use this to display the image which is uploaded by user.

<%
If Request.TotalBytes > 0 Then
  Response.BinaryWrite(Request.BinaryRead(Request.TotalBytes))
End If
%>

The code is copied from the link in previous comment.
0
 
LVL 5

Expert Comment

by:djbusychild
ID: 6153320
Vincet, I think you're misunderstanding the question
0
 
LVL 2

Author Comment

by:brookman
ID: 6153417
I have had this problem solved.  I ended up doing an object.focus then use sendkeys to fill in the box.
0
 
LVL 2

Author Comment

by:brookman
ID: 6751346
I solved this in a different way but I appreciate your effort.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question