You would need to know your file extension. Im assuming you either have it in the table or its the same file extension no matter what (say pdf).
1) Read/Write a file to a byte array and back to file
FileStream stream = File.OpenRead(@"c:\path\to\your\file\here.txt");
byte[] fileBytes= new byte[stream.Length];
stream.Read(fileBytes, 0, fileBytes.Length);
stream.Close();
using (Stream file = File.OpenWrite(@"c:\path\to\your\file\here.txt"))
{
file.Write(fileBytes, 0, fileBytes.Length);
}
Unless i completely misunderstood your question that should be what you are asking for i believe.