I am making a REST API that requires uploading files. For testing purposes, I am uploading files through postman, but I don't know how to access the files on server side. I was able to retrieve the _dict for authentication purposes, but for the file, it returns None.
#arguments - create, delete, view, list, search, upload, download
@app.post("/incident-resource/{service}")
async def incident_resource_service_handler(service, request: Request):
try:
session = Session()
reqDataForm: FormData = await request.form()
reqData = reqDataForm._dict
file = reqDataForm.get('resource') # in form(key='resource', value=abc.jpeg)
print(type(file)) #< class 'NoneType' >
user = usr_getAuthenticatedUser(session, reqData)
userRole = getRole(session, user.role_id)
except Exception as e:
session.rollback()
return handleException(e)