While using param.Parameterized
way of creating a Panel application, I am not able to obtain the name of the uploaded file. The minimal code is below, I am trying to figure out the solution for the update_name
method:
import panel as pn
import param
class TestFile(param.Parameterized):
file_upload = param.FileSelector()
file_name = param.String()
@param.depends("file_upload", watch=True)
def update_name(self):
... # how?
test = TestFile()
app = pn.Row(pn.Param(test.param, widgets={"file_upload": {"type": pn.widgets.FileInput}}))
app.servable()
It seems that doing this would require creating the widget inside the class, since pn.widgets.FileInput
does have a filename
property. Is there a way to get the file name of the uploaded file without using pn.widgets
?