Learn how to use Dash Bio for next-gen sequencing & quality control. 🧬Register for the Oct 27 webinar.

Dash Upload component returns empty 'content'

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:

Also the format is very different than expected, judging from the sample demo online.
Instead of comma separated “content_type,content_binary”, I get a string of litaral r"Data:"

Ideas or pointers on anything seemingly wrong please?

It works fine for me. Are you sure you are not uploading an empty file?

Thanks fro checking. Yes, pretty positive the file is not empty. Plus if I understand correctly from the online example in the docs, the received contents should be a comma separated tuple having the binary base64 part and the type of the file? In my case I receive just a the string ‘Data:’. It seems pretty untoward.

Thanks caiyij, I think I found my error.