☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

File name disappears after clicking the "cancel" button

Community Support
roinr
roinr

I’m using the FileInput model to upload a file.
After uploading a file, I click the “choose file” button again and click “cancel” in the file explorer dialog.
After doing so, the file name of the previous file I’ve uploaded disappears and instead I see “No file chosen”.
I tried to set a callback that is triggered on any change of the filename property but this callback isn’t being invoked (I tried the same for the “value” property as well). It seems like the properties of the FileInput instance stay the same yet the “No file chosen” message appears.
Here’s a MWE:

from bokeh.models.widgets.inputs import FileInput
from bokeh.io import curdoc

# File input.
file_input = FileInput()

# Run each time the "filename" property is changed.
def on_change(attr, old, new):
    print(old, new)


file_input.on_change("filename", on_change)


curdoc().add_root(file_input)

Is that a known bug?

⌁   Link to post
Bryan
Bryan

@roinr I think perhaps the docs will need some clarification. (cc @timo) On the Bokeh side, the filename and value properties only update when there is actual data that was successfully uploaded. If the browser widget shows something like “No file chosen” when an upload is cancelled, that is internal to the widget and invisible to us. I.e. the behavior you describe is what I would expect—no upload means no property changes.

In retrospect, it’s possible it would have been better to emit a one-off “fire and forget” event when upload is successful, rather than setting property values, since that would avoid any confusion like this, but I doubt that’s something we would try to change at this point.

⌁   Link to post

End of archived discussion · Replies are disabled