Duplicate Check
Describe the bug
It runs properly on the desktop, but can't load image on the web. Finally, I found the path attribute of FilePickerFile is None, so how could I load image from local files if it runs on the web?
Code sample
Code
def filepicker_close_event(self, e: ft.FilePickerResultEvent):
"""文件选择对话框关闭时触发的事件"""
if e.files is not None:
print(e.files)
img_obj = e.files[0]
with open(img_obj.path, 'rb') as f:
img_data = f.read()
img_b64 = b64encode(img_data).decode('utf-8')
self.image.src_base64 = img_b64
self.image.data = img_obj.name
To reproduce
I made a simple example.
import flet as ft
def main(page: ft.Page):
"""问题测试"""
page.horizontal_alignment = ft.CrossAxisAlignment.CENTER
page.vertical_alignment = ft.MainAxisAlignment.CENTER
def btn_click_event(e: ft.ControlEvent):
dialog = ft.FilePicker(on_result=dialog_close_event)
page.overlay.append(dialog)
page.update()
dialog.pick_files('选择文件')
def dialog_close_event(e: ft.FilePickerResultEvent):
print(e.files)
page.overlay.remove(e.control)
page.update()
btn = ft.ElevatedButton('打开文件框', on_click=btn_click_event)
page.add(btn)
ft.app(main, view=ft.AppView.WEB_BROWSER)
Expected behavior
No response
Screenshots / Videos
Captures

Operating System
Windows
Operating system details
Windows10
Flet version
0.23.2
Regression
I'm not sure / I don't know
Suggestions
No response
Logs
Logs
Additional details
No response
Duplicate Check
Describe the bug
It runs properly on the desktop, but can't load image on the web. Finally, I found the path attribute of FilePickerFile is None, so how could I load image from local files if it runs on the web?
Code sample
Code
To reproduce
I made a simple example.
Expected behavior
No response
Screenshots / Videos
Captures
Operating System
Windows
Operating system details
Windows10
Flet version
0.23.2
Regression
I'm not sure / I don't know
Suggestions
No response
Logs
Logs
[Paste your logs here]Additional details
No response