VB6.0 Webbrowser Control Help with Uploading Image
I have tried for hours researching and trial and error testing to get this to work, but I cannot figure it out or find an answer anywhere. I am hoping that someone here can help.
I am trying to upload an image to a site through the webbrowser control. Here is the link to the page:
When you click on the "Select Images" link, a dialog box pops up allowing to browse for the file. I have tried to get around this but can't. How can one manipulate the javascript to get an image uploaded?
Code:
Dim Doc As MSHTML.HTMLDocument
Set Doc = WebBrowser1.document
Set htmlinput = Doc.All.Item("Photo", 0)
htmlinput.Value = "file:///D:/0KCeQp-1266425414.jpg"
The above code will make an "image cannot be displayed" symbol appear in the upload image section. I am using IE9. However when you check out the properties of that file, it is not related to the file trying to be uploaded. The website's code looks like it is using a 3rd party site to upload images, however I keep getting lost in it and do not have the webbrowser control experience to figure this out. I am hoping someone here can help. Thanks.
Re: VB6.0 Webbrowser Control Help with Uploading Image
Doesn't make a difference. I tried various alternatives for the filename format. I stuck with file:///filename because this is what IE/MS Shell make a local file URL. It was the only one that worked. After your response, knowing what the result will be in advance, I tried it anyways, and sure enough it did not make a difference. I tried:
None make it work. And now that I am trying to reproduce the error, I can't even get the little red x "image cannot be displayed" icon to appear. Please help!
Re: VB6.0 Webbrowser Control Help with Uploading Image
Unfortunately this does not work. Please try to use my code at the specified URL and you will see what's going on. If your code works, please paste here because I have tried everything you've mentioned, and it does not work for me.
Re: VB6.0 Webbrowser Control Help with Uploading Image
Not to mention Silverlight isn't even present on that domain. Excuse the above responses but it's getting really frustrating when you're the only one helping and you're not even looking at the page in question.
Re: VB6.0 Webbrowser Control Help with Uploading Image
Well, the site let me upload an image, then displayed it.
Code:
a dialog box pops up allowing to browse for the file. I have tried to get around this but can't
I said the browser doesn't let websites grab files under ANY condition (other than it's own cookie)
Code:
FTP:\\serverinfo -s d:\temp\file.jpg u:xxx p:xxx
That will let you log into a serve and send a file when the user clicks.
Another EXPLORER command can open the FTP site in an Explorer window and drag and drop INTO it
Re: VB6.0 Webbrowser Control Help with Uploading Image
I don't know much about automating user input for web sites and don't really care to learn but it looks to me like you are going about it wrong. You are referencing a hidden object by name and trying to trigger an upload yet the code seems to be using a different method.
Re: VB6.0 Webbrowser Control Help with Uploading Image
Originally Posted by dglienna
Well, the site let me upload an image, then displayed it.
Code:
a dialog box pops up allowing to browse for the file. I have tried to get around this but can't
I said the browser doesn't let websites grab files under ANY condition (other than it's own cookie)
Code:
FTP:\\serverinfo -s d:\temp\file.jpg u:xxx p:xxx
That will let you log into a serve and send a file when the user clicks.
Another EXPLORER command can open the FTP site in an Explorer window and drag and drop INTO it
You said this works for you. When my application is on the site using the webbrowser control, how do I make it upload the picture and appear in the uploaded picture list on the site? Can you please post your full solution? I don't understand what you mean.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.