Click here to Skip to main content
15,889,693 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 asp.net or vb.net)
Posted
Updated 16-Oct-12 2:02am
v2
Comments
[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
C#
Byte[] ByteArray= File.ReadAllBytes("<file path>");

Byte Array to File
C#
//Do not forget to write the file extension
File.WriteAllBytes("<file path>",ByteArray);
 
Share this answer
 
v2

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