Can't access a file on iOS
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 17k
- Forks
- 694
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 33
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the reported iOS behavior using the file_picker path and the assets/image/h1.png image, then compare file access and image loading results. Check the FastAPI /upload endpoint with the returned filename and define done as successfully reading, uploading, and displaying images on iOS without relying on base64.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fastapi, ios, python
- Domain
- api, mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100