Click here to Skip to main content
15,310,017 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have many data,some of them are in (.doc/.docx/.pdf/.txt).I want to save the data of these files into sql table in the form of byte array,and when I will need it,then again want to convert them from byte array to (.doc/.docx/.pdf/.txt) for as i want.
So basically i want help to convert them to byte array and from byte array to (.doc/.docx/etc..).(Windows not in or
Updated 16-Oct-12 2:02am
[no name] 16-Oct-12 8:37am
Okay so what have you tried? In what way were the answers you have already been given inadequate?

1 solution

File to Byte Array
Byte[] ByteArray= File.ReadAllBytes("<file path>");

Byte Array to File
//Do not forget to write the file extension
File.WriteAllBytes("<file path>",ByteArray);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900