An alternative to using a separate column is Magic Numbers . Here are a few pseudo codes:
getFileExtn(BLOB) { PNGMagNum[] = {0x89, 0x50, 0x4E, 0x47} if(BLOB[0:3] == PNGMagNum) return ".png"
You will need to do this for each type of file that you support. Some obscure file types that you may need to figure out through a hex editor (a magic number is always the first few bytes of code). The advantage of using a magic number is that you get the actual file type, and not what the user simply decided to name.
source share