1

I need to upload a file from a windows computer to a server on which I have full control. But since I don't have access to that computer, a technician will copy a minimal batch script with a schedule. So I chose WINHTTPJS BATCH.

I already used it to download the file :

call winhttpjs.bat "http://192.168.1.248:8070/spectra/download-xls" -method GET -headers-file headers.txt -reportfile reportfile.txt -saveTo spectra_connect.xls

Now I need the command to specify the file to be uploaded. I tried :

call winhttpjs.bat "http://192.168.1.248:8070/spectra/upload-xls-files" -method POST -headers-file headers.txt -reportfile reportfile.txt -file spectra_connect.xls

But -file spectra_connect.xls option does not exist. I tried -body-file, but those seems to read the file contents to parse and push them. I can't even get how to send a field (like input) as the POST data. I need help on this. If I can't I'm gonna have to change to wget or curl which is more work for the remote technicians.

KeitelDOG
  • 4,750
  • 4
  • 18
  • 33
  • Switch to curl. – shadow2020 Jun 12 '19 at 18:07
  • I'm thinking to do so. But I realized that winhttpjs.bat wasn't mean to do all that stuff. Instead, I'm trying to use the WinHttpRequest object itself of microsoft which has all the options. If I can't then I'll switch. – KeitelDOG Jun 12 '19 at 23:27
  • @shadow2020, at that time I ended using curl execution file, it's portable. In case anyone want to know. Also in 2020, I gained access to the PC connected with the devices, so I wrote a Whole Server with Node JS and Express, and everything went well. – KeitelDOG Sep 28 '20 at 01:00

0 Answers0