VB 6.0 webbrowser control to automate File Input Value

I do have a webbrowser control in my VB form, while I have a file type input in my webpage. I already know the physical location of my file, and I would like the software to auto fill them.

Here is the html coding

============================
<table V5DOTBL=true border="1">
<tr valign="top"><td width="144" bgcolor="#FF9FA9"><div align="right"><a href="javascript:alert('Click the browse button to select each file you wish to attach to this message.  You may send two attachments per message.')"><b><i><font size="2" face="Times New Roman">Attachment:</font></i></b></a></div></td><td width="555" bgcolor="#FF9FA9"><font size=-1>
<input type="file" name="%%File.48256d1000036f9a.02b1bfacb55094b448256d3b002b99d2.$Body.9.19C2">
<input type="file" name="%%File.48256d1000036f9a.02b1bfacb55094b448256d3b002b99d2.$Body.9.19E4"></font>
</td></tr>
============================

I tried the VB coding

=============================
Private Sub Command2_Click()
        WebBrowser1.Document.Forms(0).Elements("%%File.48256d1000036f9a.02b1bfacb55094b448256d3b002b99d2.$Body.9.19C2").Value = "C:\test.html"
End Sub
=============================

But seems like the value never been updated.
Please have a try on the test webpage
http://www.teccalibre.com/test.html

I visited this page but still couldn't get the clue.
http://www.activevb.de/tutorials/tut_browsertags/browsertags.html#head
LVL 1
cybehAsked:
Who is Participating?
 
edwardiiiConnect With a Mentor Commented:
If we could set a value to the input file element, this might be possible.  But to my knowledge there is no way to do this.
0
 
edwardiiiCommented:
Hi, cybeh.

I've had no success either.  Per the following EE posts, it's apparently not possible to do this for security reasons:

     http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_11854758.html
     http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_20586234
     http://www.experts-exchange.com/Web/Web_Languages/HTML/Q_20186899.html

Microsoft's page regarding Input File types:

     http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/objects/INPUT_file.asp
0
 
cybehAuthor Commented:
em....Seems like i need to request the user to add the file in manually......:(
0
 
cybehAuthor Commented:
oh...or is there any possible way that, I already set focus to the input box, and make a simulation like the string is typing in by the keyboard? Hope you get what I mean. If that is possible, may i know how?
Since the file location might be very long, it might be troublesome for the user to type in. So, as long as the user set a focus on the input box, by click on a button, the "C:\test.html" will be auto apear.

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.