Link to home
Start Free TrialLog in
Avatar of durick
durickFlag for United States of America

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.WinHTTPrequest.5.1")

    http.Open "GET", strformurl, False
          http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
           http.setRequestHeader "Cookie", session
          http.send
          http.waitForResponse 400
           http.response = response
          msgbox "response =- " & response
            http.send (strFile)
[/code
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

What's the question?

Jim.
Avatar of durick

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.
Avatar of durick

ASKER

Thanks here is the webpage source.
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.
ASKER CERTIFIED SOLUTION
Avatar of durick
durick
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial