durick
asked on
Winnhttp request to upload XML file
my ms access application(vba) creates .xml files
I need to upload one .xml file to a web page using winhttp requests
I have the web site url address and I have a session ID
the url address is https://............
here is my code
[code]]Set http = CreateObject("WinHTTP.WinH TTPrequest .5.1")
http.Open "GET", strformurl, False
http.setRequestHeader "Content-Type", "application/x-www-form-ur lencoded"
http.setRequestHeader "Cookie", session
http.send
http.waitForResponse 400
http.response = response
msgbox "response =- " & response
http.send (strFile)
[/code
I need to upload one .xml file to a web page using winhttp requests
I have the web site url address and I have a session ID
the url address is https://............
here is my code
[code]]Set http = CreateObject("WinHTTP.WinH
http.Open "GET", strformurl, False
http.setRequestHeader "Content-Type", "application/x-www-form-ur
http.setRequestHeader "Cookie", session
http.send
http.waitForResponse 400
http.response = response
msgbox "response =- " & response
http.send (strFile)
[/code
ASKER
This code does not work
Depends on the web site....it has to be able to accept a file upload. There's no way to tell what your doing wrong without know the site and what it requires.
Jim.
Jim.
ASKER
Thanks here is the webpage source.
site3.txt
site3.txt
I'm not a web developer, but I understand the basics and the only way I can see you being able to do this is to automate an instance of Internet Explorer as the file upload is being done via a form on a web page. An example of that I found out on the net is here:
https://www.motobit.com/tips/detpg_uploadvbaie/
To be able to upload a file directly without doing that, the site would have to offer a REST API for the file submission (meaning they have a specific URL used to upload the file). Some sites also offer direct FTP transfers.
But if you are just working with a web page, you'll need to do it via IE automation.
Jim.
https://www.motobit.com/tips/detpg_uploadvbaie/
To be able to upload a file directly without doing that, the site would have to offer a REST API for the file submission (meaning they have a specific URL used to upload the file). Some sites also offer direct FTP transfers.
But if you are just working with a web page, you'll need to do it via IE automation.
Jim.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Jim.