Converting Image File to Binary
There was required in one of project couple of months ago, wherein
the image files have to be stored/inserted into the database using BizTalk.
Although we know that keeping files on folder location is
much better than storing it in Database, we had to implement.
Note: BLOBs(Image files, Video files etc) smaller than 256KB are more efficiently handled by a database,while a filesystem is more efficient for those greater than 1MB. Of course, this will vary between different databases and filesystems.
It seemed to be challenging at the beginning, but was an
interesting experience for me and my colleague
Dhiraj Bhavsar.
To achieve this, we came up with a solution of creating a
Helper class which will convert the file into binary and later can be used .
Below is a screenshot of Helper Class, which accepts a file path as
input and returns data in bytes and deletes the file.
Note: This can used for other types of files also.
Download Helper Class Code : FileReader - Helper Class to convert file into Bytes
Have composed an article as to how to insert images in SQL, have a look : BizTalk Server 2010: How to Insert Image In SQL Through Orches07ation
Download BizTalk Server 2010: How to Insert Image In SQL Through Orches07ation Sample
Download Helper Class Code : FileReader - Helper Class to convert file into Bytes
Have composed an article as to how to insert images in SQL, have a look : BizTalk Server 2010: How to Insert Image In SQL Through Orches07ation
Download BizTalk Server 2010: How to Insert Image In SQL Through Orches07ation Sample
Comments
Post a Comment