Solved

webbrowser problem

Posted on 2001-06-03
8
206 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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now