|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Help : upload filewinhttp : I would like to Upload file (xml) as if I sent a form :
<form action="URL_page" method="post" enctype="multipart/form-data" name="Form_Export_OFAA"> <input type="file" name="file" value="FILE.xml" > <input name="STR1" type="hidden" value="12"> <input name="USER" type="hidden" value="user1"> <input name="PASSWORD" type="hidden" value="pass_user"> <input type="submit" name="Submit" value="Envoyer"> </form> My language is VB Somebody could help me ? Landry For a www-form-urlencoded type login form, I was able to POST some data
using the following code: (It uses ServerXMLHTTP, but then I guess WinHTTP isn't much different from ServerXMLHTTP) set oSH = CreateObject("Msxml2.ServerXMLHTTP.3.0") oSH.open "POST", "http://www.abcd.com/check.asp", false oSH.setRequestHeader "Content-Type","application/x-www-form-urlencoded" oSH.send "user_name=" & username & "&passwd=" & password response.write oSH.ResponseText oSH.close Posting a file would require slight modifications to the example above, you can easily send the appropriate body in the multipart-data format. This excerpt (from http://www.faqs.org/rfcs/rfc1867.html.old) will help you compose the body of the message. Suppose the server supplies the following HTML: <FORM ACTION="http://server.dom/cgi/handle" ENCTYPE="multipart/form-data" METHOD=POST> What is your name? <INPUT TYPE=TEXT NAME=submitter> What files are you sending? <INPUT TYPE=FILE NAME=pics> </FORM> and the user types "Joe Blow" in the name field, and selects a text file "file1.txt" for the answer to 'What files are you sending?' The client might send back the following data: Content-type: multipart/form-data, boundary=AaB03x --AaB03x content-disposition: form-data; name="field1" Joe Blow --AaB03x content-disposition: form-data; name="pics"; filename="file1.txt" Content-Type: text/plain ... contents of file1.txt ... --AaB03x-- No problem with the first part of your code but I don't understand how
integrer the XML file to the code "spacewarp" <sureshsita***@gmail.com> a écrit dans le message de news: 1120037633.266264.33***@g14g2000cwa.googlegroups.com...Show quoteHide quote > For a www-form-urlencoded type login form, I was able to POST some data > using the following code: > (It uses ServerXMLHTTP, but then I guess WinHTTP isn't much different > from ServerXMLHTTP) > > set oSH = CreateObject("Msxml2.ServerXMLHTTP.3.0") > oSH.open "POST", "http://www.abcd.com/check.asp", false > oSH.setRequestHeader "Content-Type", > "application/x-www-form-urlencoded" > oSH.send "user_name=" & username & "&passwd=" & password > > response.write oSH.ResponseText > > oSH.close > > > > Posting a file would require slight modifications to the example above, > you can easily send the appropriate body in the multipart-data format. > This excerpt (from http://www.faqs.org/rfcs/rfc1867.html.old) will help > you compose the body of the message. > > Suppose the server supplies the following HTML: > > <FORM ACTION="http://server.dom/cgi/handle" > ENCTYPE="multipart/form-data" > METHOD=POST> > What is your name? <INPUT TYPE=TEXT NAME=submitter> > What files are you sending? <INPUT TYPE=FILE NAME=pics> > </FORM> > > and the user types "Joe Blow" in the name field, and selects a text > file "file1.txt" for the answer to 'What files are you sending?' > > The client might send back the following data: > > Content-type: multipart/form-data, boundary=AaB03x > > --AaB03x > content-disposition: form-data; name="field1" > > Joe Blow > --AaB03x > content-disposition: form-data; name="pics"; > filename="file1.txt" > Content-Type: text/plain > > ... contents of file1.txt ... > --AaB03x-- >
memory issue
RaiseEvent from an item to collection Back to Square 1 -- User Control and GUID problems... I can't figure out the *$#! licensing select case syntax format function error? Newbie help - list every file in folder AND subfolders? collection clone? Passing an Array Name Comctl32.ocx problem URGENT! |
|||||||||||||||||||||||