C#C
C#16mo ago
Kaygee

Convert a Binary string to a file

Hello Guys,

I created this code which convert a text file to be copied into a image field in SQL server

FileStream stream = new FileStream(filePath, FileMode.Open, FileAccess.Read);
BinaryReader reader = new BinaryReader(stream);

byte[] Fichier = reader.ReadBytes((int)stream.Length);
reader.Close();
stream.Close();

return Fichier;


How can I do the inverse ?

I would get the binary from sql and copy content into a file

Thanks
Was this page helpful?