[GetMimeTypes by Magic Numbers] CSV files
Service icon
Forge component by Rui Félix

The component does not work for CSV files. Could the CSV files not have magic numbers or something like that? It always returns the default application/octetstream MIME TYPE when I try with a CSV file.

Hi Vasco,

indeed your guess is right. A CSV file does not any 'telltale' bytes which identify the file type, hence this component will always tell it as 'Text/Plain'.

You may try to upload a demo CSV file here before implementing it and test some files.

Hi Rui,

Thanks for the fast reply!!

But 'Text/Plain' would be ok for me, the problem is that it's telling me the file is an application/octetstream on uploading any of my csv files. If you tried it could you send me the CSV files you are trying with.


No problem.

I just googled 'example csv file' and downloaded a csv file from here and attached on this reply.

Are your csv files generated by your outsystems application? If so, on the download widget are you setting the mimetype as 'Application/octetstream' since it's the default on the OutSystems platform?


If my file as more than 240 bytes the component tells me that is a text/plain, if it has 240 or less it's  an "application/octet-stream".

Any idea why?

Hi Rui,

Couldn't find a solution. We think the problem is coming from this service https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms775107(v=vs.85) . Something is making it return application/octet-stream.


Hi Vasco, 

indeed the CSV files do not have magic numbers, and the possible outputs are always 'Text/Plain' or 'Application/octet-stream', depending on the file size.

These two outputs reveal that the file content is ambiguous. They mean exactly the same. More info can be found here.

Your best shot would be to perform the following validation:

(Extension = '.csv' and (mimetype = 'text/plain' or mimetype = 'application/octet-stream'))

If this condition is true, then most likely the file is a csv file. This is not bullet proof but since you have no magic numbers available, it's your best shot.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.