1

I am using python Panel FileInput widget (panel==0.13.0) to upload a file. Upload works, but I can’n find a way to access uploaded file name. However, after selecting file the widget displays filename next to it, but filename is not included in objects, nor filename,…

Using file_input.get_param_values(), I will get filename=None…

import panel as pn

class WidgetManager:
    def __init__(self):
        self.load_row = self.load_file_widget()

    def load_file_widget(self):
        # Create a row of widgets for file load
        self.file_input = pn.widgets.FileInput(accept='.csv')
        load_row = pn.Row(self.file_input)
        print(self.file_input.filename)
        return load_row

# Create an instance of the WidgetManager class 
widget_manager = WidgetManager()

# Create a FastList dashboard and add the widgets to it 
dashboard = pn.Column(widget_manager.load_row)

# Show the dashboard 
dashboard.show()

Any idea how can I access to the uploaded filename?

Saeid SOHEILY KHAH
  • 747
  • 3
  • 10
  • 23

0 Answers0