PDA

Click to See Complete Forum and Search --> : Webbrowser: submitting form and upload image


Trickster3D
Jun 15th, 2007, 01:45 PM
Hello, hope this is the right forum.
I'm in the process of making a program to upload images at deviantart.com, but i'm facing 2 problems:
First problem is that I need the program to somehow upload an image from a default/preset folder (means I have the image destination). The 2 attached images shows what this looks like. Either that (clicking upload button and choose the file through dialog) or setting the image path through the code somehow if thats possible? Here is the html code for the upload button:
<a href="#" class="addfile" id="addfile_button" title="use this button to browse for a file on your computer and upload it to deviantART">
<form name="file_upload_1181809680" action="deckpost" enctype="multipart/form-data" method="post">
<input type="file" id="deck_file_upload" name="deck_file"/>
</form>
</a>

Second problem is that when I have filled in all the text fields and chosen category (and manually uploaded image), I make the program submit the whole form to confirm image upload, but it gives me 4 errors:
Description cannot be empty.
Keywords cannot be empty.
You need to agree to the submission policy in order to post deviations.
You need to agree to the terms of service in order to post deviations.
Although I have filled them out, and checked boxes. The code i'm using for this is:
WebBrowser1.Document.All("devtitle").Value = "test1" 'Title

WebBrowser1.Document.All("chooseCatBtn").Value = "Change..."
WebBrowser1.Document.All("categoryId").Value = 357
WebBrowser1.Document.All("categoryTitleDisplay").innerhtml = "Designs & Interfaces, Buttons" 'category

WebBrowser1.Document.All("devdesc").Value = "test2" 'description

WebBrowser1.Document.All("devkeywords").Value = "test3" 'keywords

WebBrowser1.Document.Forms("form3")("sp_agree").Checked = True 'Agree SP
WebBrowser1.Document.Forms("form3")("tos_agree").Checked = True 'Agree TOS

WebBrowser1.Document.Forms(1).submit 'submit form
and weird thing is when I let the program auto fill out everything, and I manually click the submit button, it works perfectly. The submit buttons html code:
<input class="continue" type="button" onclick="SPDeviation.nextScreen('deviation', 'save');" value="Submit" />
Well I don't know if I need to program it to confirm more forms or something like that, but hope some of you guys can help me with that, and if anybody need the html code for the whole webpage, i've attached that too.

Thanks to anyone who helps me. :thumb:

Hack
Jun 15th, 2007, 01:51 PM
Welcome to the forums. :wave:

I don't think it belongs in network programming, but I'm not sure whether I should move it to the HTML section or the VB6 section.

Do you know which part of your code is giving you the problems?

Trickster3D
Jun 15th, 2007, 01:55 PM
Well I think the best place would be vb general then :)