strawberry
strawberry copied to clipboard
Getting the file name and type when uploading
Framework: sanic Is there any way to get the name and type of the uploaded file? We are currently using this implementation:
for _, file_list in info.context.req.files.items():
file_name = file_list[0].name
file_size = len(file_list[0].body)
file_type = file_list[0].type
Is there a more correct way to get this data using the Upload scalar?
@offbrok yes, unfortunately the current implementation of Upload returns a BytesIO object for Sanic:
![image](https://user-images.githubusercontent.com/667029/165338506-252b1983-bc8b-4d4b-a41a-16ee83df681d.png)
we might want to change that