def upload_data(contents, filename): """Upload Files and Regenerate the file list.""" if contents: for i in range(len(filename)): FileUtils.upload(filename[i], contents[i]) files = FileUtils.files('raw') if len(files) == 0: options = [{'label': 'No files uploaded yet!', 'value': 'None'}] return options else: options = [{'label': file, 'value': file} for file in files] return options
def get_options(dir: str): files = FileUtils.files(dir) if len(files) == 0: return [{'label': 'No files yet!', 'value': 'None'}] else: return [{'label': file, 'value': file} for file in files]
'lineHeight': '50px', 'borderWidth': '1px', 'borderStyle': 'dashed', 'borderRadius': '5px', 'textAlign': 'center', 'margin': '10px' }, multiple=True), html.Br(), html.Div([ html.H2("Select a file from all the uploaded files:"), dcc.Dropdown(id='selected-file', options=[{ 'label': file, 'value': file } for file in FileUtils.files('raw')], value=None, multi=False), html.Br(), ], style={ 'margin': '10px', 'width': '50%' }), html.Div([], id="display-file"), html.Div([], id="file-properties"), html.Div([], id="file-separator-do-nothing"), html.Div([], id="file-header-do-nothing") ])
'width': '50%', 'height': '50px', 'lineHeight': '50px', 'borderWidth': '1px', 'borderStyle': 'dashed', 'borderRadius': '5px', 'textAlign': 'center', 'margin': '10px' }, multiple=True), html.Br(), html.Div([ html.H2("Select a file from all the uploaded files:"), dcc.Dropdown( id = 'selected-file', options=[{'label':file, 'value':file} for file in FileUtils.files('raw')], value=None, multi=False ), html.Br(), ], style = {'margin': '10px', 'width': '50%'}), html.Div([], id = "display-file"), html.Div([], id = "file-properties"), html.Div([], id = "file-separator-do-nothing"), html.Div([], id = "file-header-do-nothing") ]) @app.callback( Output("selected-file", "options"), [Input('upload-data', 'contents'),