MicroPython_ESP32_psRAM_LoBo icon indicating copy to clipboard operation
MicroPython_ESP32_psRAM_LoBo copied to clipboard

how to post files to remote server?

Open thugbobby opened this issue 5 years ago • 1 comments

Hello. I want to post some files to remote server.But I have not found how to post. In python, I can post file like this:

import requests
payload = {}
files = [
  ('uploads2', open('/D:/cat.png','rb')),
]
headers= {}
response = requests.request("POST", url, headers=headers, data = payload, files = files)
print(response.text.encode('utf8'))

but in micropython, what should I do? the urequests doesn`t have parameter files.

Thanks for your help!

thugbobby avatar Aug 11 '20 03:08 thugbobby

Look here https://github.com/jono-allen/MQTT-Cam/blob/master/uploader.py

k4m454k avatar Aug 12 '20 23:08 k4m454k