0

I'm trying to make a post request in R sending an image that was read as binary. Currently, i have the following code in Python that does exactly what i need:

image = open(IMAGE_PATH, "rb").read()
payload = {"image": image}
r = requests.post(url, files=payload)

I'm trying to do exactly the same but in R, which i've not been able to do. Any advice is welcome.

Ghost
  • 1,426
  • 5
  • 19
  • 38
  • What is the R code you tried? Where exactly did you get stuck? Do you have some example server that can be used for testing? – MrFlick Apr 02 '19 at 14:00
  • Let's say i haven't tried anything and i'm starting from 0, how would you do it? – Ghost Apr 02 '19 at 14:04
  • 1
    Well, google should be your first start. We expect questions here have been well researched first. Here's a previous question which will probably help: https://stackoverflow.com/questions/47554132/translating-a-curl-command-to-r-using-httr-specifically-data-binary. The package that would be most helpful to you is `httr`. – MrFlick Apr 02 '19 at 14:20

0 Answers0