Hi I am trying to reproduce a very simple upload example from Dash documentation.
I am receiving a content of the form ‘Data:’ and not a binary in the expected format according to the documentation of the component. Has something changed in the Upload component relative to the documentation?
Many thanks!
Example code:
@app.callback(Output(‘uploadOutputDiv’, ‘children’),
[Input(‘noteUploader’, ‘contents’)],
[State(‘noteUploader’, ‘filename’),
State(‘noteUploader’, ‘last_modified’)])
def upload_file_chooser_cb(list_of_contents, list_of_names, list_of_dates):
if list_of_contents is None:
return [’’]
# inputs = [ { ‘file_name’: name,
# ‘file_binary’: contents.split(’,’)[1],
# ‘file_type’: contents.split(’,’)[0],
# ‘date’: date }
# for contents, name, date in zip(list_of_contents, list_of_names, list_of_dates)
# ]
#content_type, content_string = list_of_contents[0].split(’,’)
#decoded = base64.b64decode(content_string)
children = [list_of_contents[0][0:100]+’…’, str(list_of_names), str(list_of_dates)]
return children
Example output in the Pre:
data:…[‘sample.docx’][1548168722.627]