FilePickerUploadFile Fails When Filename Is Modified #5029
-
QuestionI'm experiencing an issue with I didn't find anything in the documentation regarding this issue or how the filename should be passed. I assume the filename must be exactly the same as on the user's computer. The problem with this is that I'm creating a web app where users can upload multiple images, and I'm trying to rename the file using a format like DATETIME_USER-ID.EXTENSION to avoid conflicts with other images that may have the same name, even if I separate each user's files into individual folders in the uploads directory. For example: I tried uploading the image first, regardless of its filename, and then modifying it later. However, once the image is uploaded, it automatically replaces the previous version. Code sampledef handle_file_selection(e: ft.FilePickerResultEvent) -> None:
if e.files:
file = e.files[0]
upload_datetime = datetime.now().strftime('%Y%m%d%H%M%S')
ext = file.name.split(".")[-1] if "." in file.name else "bin"
filename = f"{upload_datetime}_{self.user_uid}.{ext}"
upload_url = self.page.get_upload_url(filename, 60)
uploader = [
ft.FilePickerUploadFile(
name=filename,
upload_url=upload_url
)
]
file_picker.upload(uploader) Error messageNo error message ------------------------------------------------------
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Yeah, that's the current implementation. Opened an issue to support your usecase: #5037 |
Beta Was this translation helpful? Give feedback.
Yeah, that's the current implementation.
Opened an issue to support your usecase: #5037