flet
flet copied to clipboard
Can't access a file on iOS
I use file_picker to upload images to the server with the API. File_picker returns to me FilePickerfile (Name = 'Img_3443-1710921130437.PNG', Path = '/private/var/mobile/containers/data/application/f086d08b-9383-40BC-A493-7880E4B2A7E8/TMP/IMG_3443-171043337 png', size=1991887) I can't read the file as with..open.. is there any way to do this? The API I use is the fast api to upload images as follows:
@router.post('/upload')
async def upload_image(file: UploadFile = File(...)):
contents = await file.read()
#print(contents)
os.makedirs('upload/image', exist_ok=True)
with open(f"upload/image/{file.filename}", "wb") as f:
f.write(contents)
return {"status": True}
Furthermore, I cannot load images when running on iOS even though the paths are correct, for example: assets/image/h1.png.. I still can't display the control image. I have to use it by saving the image with base64 and reloading it with base64.