Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IW15 FileUplader and GetUploadedFileMimeType
#2
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
Reply


Messages In This Thread
RE: IW15 FileUplader and GetUploadedFileMimeType - by Alexandre Machado - 10-22-2019, 07:57 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)