Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi all

Please tell me How to convert .doc/.docx file to byte array and save it to database..

thank you
Posted
Comments
Sergey Alexandrovich Kryukov 11-Dec-12 0:59am    
It can possibly be a too big array, do you know? What's the problem though? Read on reading the files. System.IO.
--SA
[no name] 11-Dec-12 1:02am    
I have to save resume i.e. doc file and have to retrieve it from database..is there any other option to do that..??

1 solution

Hi,
Use this
FileStream fs = new FileStream(Filepath, FileMode.Open, FileAccess.Read);

                        fileLen = Convert.ToInt32(fs.Length); 
                        Data = new byte[fileLen];
                        fs.Read(Data, 0, fileLen);
                        fs.Close();


data contains bytes of data.
 
Share this answer
 

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