Allow a certain filetype with dcc.Upload

Hi,

is there a way to specify the filetype a user can upload using dcc.Upload?

Hey,
yes there is an attribute of dcc.Upload called accept link: https://dash.plotly.com/dash-core-components/upload

accept (string; optional): Allow specific types of files. See GitHub - react-dropzone/attr-accept: JavaScript implementation of the "accept" attribute for HTML5 input element for more information. Keep in mind that mime type determination is not reliable across platforms. CSV files, for example, are reported as text/plain under macOS but as application/vnd.ms-excel under Windows. In some cases there might not be a mime type set at all.

So for example accept = ‘.zip’

1 Like