Skip to content
Advertisement

Flask – How to get the file extenstion, without using file.content_type

I have this code:

JavaScript

And what I would like to do is get the file extenstion, like .md, .txt and automatically add it to the list of allowed content types.

I have looked at the docs but can’t find what I’m looking for.

Heres the content type list:

JavaScript

Thanks in advance!

Advertisement

Answer

Looking at the comments, it seems your answer is pretty clear.

Just allow any file type and don’t use MIME types.

Thank @Anonymous and @J.G.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement