This topic is locked
[SOLVED]

File types for upload?

9/24/2021 4:44:30 PM
ASPRunner.NET General questions
Pete K author

When configuring a file upload control, is it important to specify file types for the sake of safety? Or is that a moot point since running executables on the server wouldn't work anyway (unless the user had already hacked the server.)

I don't want to be too restrictive and frustrate my users, but trying to think of all the various image and document types is bound to leave something out. If we should specify file types, what would be the recommended list to take in as many as possible?

This is what I'm currently using: bmp,doc,docx,gif,jpeg,jpg,pdf,png,rtf,txt,tif,tiff,eps,raw

Thoughts?

—Pete

admin 9/27/2021

This is not a security feature definitely, just a convenience feature.

For instance, if you only accept PDF files you can limit extensions to pdf. If you only accept web-ready image you can limit extensions to gif,png,jpg. Specifying too many extensions is kind of similar to just allowing all kind of files.

Pete K author 9/27/2021

Thanks.