How to know if Dcc.Upload is completed

I am using Dcc.Upload component to upload few files all at a time. Once uploaded, I need to remove or hide it. But what is happening is that on initial page load itself that is getting hidden by the callback. So, if there is a way to know that upload is completed, I can hide it based on that in the call back. I am using the same code as in the first example in the documentation at https://dash.plotly.com/dash-core-components/upload

Hi @kirk77, you can check whether the contents attribute of your dcc.Upload is None (nothing uploaded) or not.

@app.callback(
    Output("upload_id", "style"),
    [Input("upload_id", "contents")]
)
def hide_upload(contents):
    if contents is not None:
        return {"display": "none"}
    return dash.no_update

@RenaudLN Thank you very much. It worked. I had the same code and it did not work. Only difference I had is the if condition. I had

if not contents:

and you have

if contents is not None

I thought contents would be missing so it would work. But looks like contents has a value of None and not null/missing.