Can't upload (some) data files using upload dialog

What I’m trying to do:
Trying upload a data file using the data file upload UI. I wanted to stick a few empty files in the directory so that I could write some data to them - (a one-time write, but just easier to do from within my existing code on anvil rather than make the files outside.)

What I’ve tried and what’s not working:

  • I tried to upload an empty text file (639b781752fc2fc16f05d3cc.dat) from Notepad++, the upload dialog shows up, but the file doesn’t upload - even after refresh. Neither upload button nor dragging works. Neither does switching browsers, trying with different anvil apps.

What I’ve tried and what’s working:

  • I made a file with some random numbers typed into it and called it file.txt - uploaded as expected and allowed me to change the name to the file name I originally wanted. Somewhat annoying because I need to delete the content of the file to get it back to empty…

My guess?
Maybe the file size (too small?) or some other issue is creating an non-annunciated error?

Indeed empty txt files are not showing. Tested it in my app.

Wouldn’t it be easier to create those files on your own via code then write the data into it?
Why uploading an empty one?

with open('example.txt', 'w') as file:
    # Write some text to the file
    file.write('Hello, world!\n')
    file.write('This is an example text file.\n')

Yep - and ultimately that’s what I’m doing. I also (eventually) understood that the data files are just media files in a “files” data table - and they can be uploaded there. It mainly was just an odd behavior/bug/feature!