Click here to Skip to main content
14,303,684 members
Rate this:
Please Sign up or sign in to vote.
See more:
0x1F8B0800000000000400EDBD0.......9AD6474F0000


This is the binary data saved in database. It is a file actually and I don't know which type of file it is.
I tried via writeallbytes to gz format as its started with 0x1F,but failed.
When I save a gz file in binary format,it saved and can be retrieved successfully.
So how can I know what file it is,so that I can write the bytes to that format?
Posted
Updated 30-Nov-15 20:07pm
v5
Comments
   
Sorry, this question is incorrect. It could be anything. Why anyone should try to decrypt any kind of garbage. If there is no any metadata, the data could be considered lost.
—SA
souvikcode 1-Dec-15 2:26am
   
why?You can see the improved question.

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

When you save file in database it normally save in Byte(binary) format, you can save it back to file using File.WriteAllBytes() method, it Creates a new file, writes the specified byte array to the file, and then closes the file. If the target file already exists, it is overwritten.

see below snippet
//read column value from database
//store it in ByteArray
//and then write ByteCode to file
Byte[] objByte = (Byte)dr["col1"];
System.IO.File.WriteAllBytes("D:\\test.jpg",objByte);

In above example I have take file format as JPG cause I know the file which I have saved in database is .JPG, you should know the file extension/format before retrieve frile from database
   
Comments
souvikcode 1-Dec-15 1:43am
   
This is a very easy thing what you wrote.I did not want to know this. I don't know the file type saved in database as this program was developed 2 years ago and developer has gone.
koolprasadd 1-Dec-15 2:05am
   
if you are not aware of MIME type then it is really hard thing to find out, I have some snippet to check but I haven't tried it at my end
byte[] content = ;
InputStream is = new BufferedInputStream(new ByteArrayInputStream(content));
String mimeType = URLConnection.guessContentTypeFromStream(is);


below link is also useful
http://www.garykessler.net/library/file_sigs.html
souvikcode 1-Dec-15 2:26am
   
Yes,I don't know the file type. That's why I posted question if any one can suggest what the file may be.
koolprasadd 1-Dec-15 2:33am
   
try my solution given in earlier comment
souvikcode 1-Dec-15 2:36am
   
does it require internet connection? Mind it I'm using c# desktop application.
koolprasadd 1-Dec-15 2:44am
   
No, just read given link, it will help you to identify file type using binary text

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100