Long filenames lead to problems when using the upload component

Hey there,

I am having a problem using the dash Upload component.

There is an ordinary Upload component that is specified by

dcc.Upload(
    id='upload-data',
    children=html.Div([
        'Drag and Drop or ',
        html.A('Select a File ( .db)')
    ]),
    style={
        'width': '100%',
        'height': '60px',
        'lineHeight': '60px',
        'borderWidth': '1px',
        'borderStyle': 'dashed',
        'borderRadius': '5px',
        'textAlign': 'center',
        'marginTop': '10px'},
    multiple=False),

I use it to Upload database files which have a table called “log”.
The problem is, that some collegues are getting the error “no such table log” when uploading database files and trying to access them.

I can not force the error at my system, it just happens to some others (all same OS, windows 10)

The problem is solved after renaming the file and using a shorter filename.
They can access the db file normally afterwards, but this is not a desirable solution.

So it has to do with the filename’s length. I think it is all about the Upload component itself and the given path length and has nothing to do with the sqlite access because dash upload does only receive the content of the file which is the same …

Are there ideas how to solve this?

hi @mahack
I have a Windows machine as well. I tried uploading a data file with a very long name but I couldn’t replicate the error. I tried an even longer file name and it still worked.

Are there any other clues as to why this is not working for your colleagues?

Hi @adamschroeder ,

thank you for taking the time and the helpful answer. After your reply, I again took a closer look at the problem, tried some things and it now seems more like I should avoid the Upload component for db files in the future as it has to store the whole content and I am using dash rather for local usages than for the server solution it should be.

I am looking for a quick fix until I found a better way - do you know how to save the read-in content to the memory or a defined temporary file path (content >> .db file)? The aim is to just select a locally stored database file (.db) and provide a new defined string filepath of the copied file (known_file_path\same.db) to sqlite3…