How to send file&

i trying to send file to my new endpoint, which look like this:

@v2.route(’/up_file’, methods=[‘GET’, ‘POST’])
def decode_watermark(request):
test = request.files
return json({“ok”: “200”})
if i send file from postman, using application/x-www-form-urlencoded header and form-data field, i get {} in print()
can you explane,how can I get some file without download it in file system?

For example, i want to send image to sanic, getting EXIF and return it

Hi there,

Could you share how did you send a file with postman? I think your code snippet should work except that the request sends from postman is not a valid file upload request.

Here is an example that I use postman to send a image file:

As you can see, I did not set any header in this request.

And, to get EXIF from the uploaded image, you can save it to BytesIO and use PIL to read it, for example:

from sanic import Sanic
from sanic.response import text
from io import BytesIO
from PIL import Image

app = Sanic()"")
async def get_image_exif(request):
    image = request.files.get("image")
    image = BytesIO(image.body)

    image =
    exif = image._getexif()

    return text(exif)