Hii, i am creating an application where i want to check that the binary file is image or not if not then provide a download option .
Hi Prashant,
It's a bit silly to say "I don't want to use a Forge component", as Forge assets are explicitly meant to extend the OutSystems Platform in case there's no standard functionality that covers your requirements, and in case you cannot write the code yourself.
As for images, there are a couple of possibilities. The easiest is, like Nash wrote, to check the file name and see if it's a known image file extension. You could also write an extension (since you do not want to use Forge assets) that investigates the file header, and checks whether it contains signatures of known image file types. Since basically nowadays there's JPEG and PNG (and perhaps GIF and BMP) to worry about and not much else, this should be doable.
Hi Prashant Bais,
Please check this forge component it might be suitable for your purpose
https://www.outsystems.com/forge/component-overview/6901/getmimetypes-by-magic-numbers
Hope that it helps you
Hello Prashant,
You can check this component to see if you can work around.
https://www.outsystems.com/forge/component-overview/7202/file-type-file-extension
Best Regards
I don't want to use any forge component i want on click of paper clip icon if image then open pop up otherwise download the image
I do not think you will be able to check if the binary of a file is an image without using a forge component or creating an extension yourself.
However you could check the filename if it holds the extension of the file. So for example if the filename ends on .png or .jpg you could show the image element and otherwise download the file. But you will need to make sure that the filename holds the extension.
Hope this give some more insights!Nash