logoalt Hacker News

eliseumds06/30/20251 replyview on HN

I'm dealing with mime types and max file sizes for an uploader, and improving error messages. Instead of relying on the file name to detect the mime type, I'm using the file binary header instead to reject dodgy files (for ex a `sample.jpg` file that is actually a ZIP or EXE under the hood).


Replies

andai06/30/2025

Are you doing

    head -c 512 file.bin | file -
show 1 reply