Solved

webbrowser problem

Posted on 2001-06-03
8
214 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Disable Security Alert  popup in Winforms  embedded webbrowser. 1 57
Asp in script 6 36
Add or delete table rows 10 53
ASP.NET Content Page 3 25
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…

839 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