examples icon indicating copy to clipboard operation
examples copied to clipboard

Uploading a local blob using FilePicker.upload() on Web

Open JosueAChavez opened this issue 2 years ago • 1 comments

The AudioRecorder's stop_recording() method returns a Blob URL when it stops recording (example: blob:http://127.0.0.1:56495/c914bef7-8043-4b2f-9794-b2760b9bf20c).

What is the correct way to read that into FilePicker's upload method so it can be stored in the system that's running the flet application? When creating a FilePickerUploadFile for the upload, I tried using it using Page's [get_upload_url](https://flet.dev/docs/controls/page/#get_upload_urlfile_name-expires) for the upload_url field , but I'm not sure what filename should be.

This is what I've been doing. Nothing happens and no errors are thrown

        uf = []
        filename = recorder.stop_recording()
        url = page.get_upload_url(filename, 600)
        
        uf.append(
            ft.FilePickerUploadFile(
                filename,
                upload_url=url,
            )
        )
        file_picker.upload(uf)

Any help would be greatly appreciated! Thanks!

JosueAChavez avatar Nov 14 '24 05:11 JosueAChavez

I'm currently having the same issue. I'm trying to get an audio recording to my backend from flet web. Did you find a solution @JosueAChavez ?

ljouhault avatar Nov 24 '25 10:11 ljouhault