10-22-2019, 07:57 AM
(This post was last modified: 10-22-2019, 08:05 AM by Alexandre Machado.)
Use TIWFileUploader.CheckMimeType instead. This has been refactored and included in production code after I wrote this demo.
It will be updated.
This is some experimental code to retrieve the mime type of the uploaded file, based on a simple analysis of the uploaded file signature.
It can detect a very limited set of files based on this method:
MIME types *possibly* detected are:
'image/bmp';
'application/msword';
'application/x-msdownload';
'image/gif';
'image/x-ico';
'image/jpeg';
'audio/mpeg';
'audio/ogg';
'application/ogg';
'video/ogg';
'application/pdf';
'image/png';
'application/x-rar-compressed';
'image/tiff';
'application/x-font-ttf';
'video/x-msvideo';
'audio/wave';
'audio/x-ms-wma';
'video/x-ms-wmv';
'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
'application/zip';
Please have in mind that this is not a fail proof method. It is just a convenience to users which want to give some sort of protection, restricting the upload to some specific file types
It will be updated.
This is some experimental code to retrieve the mime type of the uploaded file, based on a simple analysis of the uploaded file signature.
It can detect a very limited set of files based on this method:
MIME types *possibly* detected are:
'image/bmp';
'application/msword';
'application/x-msdownload';
'image/gif';
'image/x-ico';
'image/jpeg';
'audio/mpeg';
'audio/ogg';
'application/ogg';
'video/ogg';
'application/pdf';
'image/png';
'application/x-rar-compressed';
'image/tiff';
'application/x-font-ttf';
'video/x-msvideo';
'audio/wave';
'audio/x-ms-wma';
'video/x-ms-wmv';
'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
'application/zip';
Please have in mind that this is not a fail proof method. It is just a convenience to users which want to give some sort of protection, restricting the upload to some specific file types

