Dears, Good Day,
I have a case that receives a file
with base64
string format only, and there is no meta-data
sent about this file
and the requirement is to validate the the file type then accepts or rejects it,
I depend on this links below how to handle this issue. and it really helped.
How to get MIME-TYPE from Base 64 String?
in this part:
....
var signatures = {
JVBERi0: "application/pdf",
R0lGODdh: "image/gif",
R0lGODlh: "image/gif",
iVBORw0KGgo: "image/png"
};
.......
this sample till now works on pdf
, gif
, jpg
, tiff
, png
and text
.
but the issue in docx
, xlxs
, pptx
the MIME type is the same for all
UEsDBBQABgAI..
I tried to Upload Many times the files on
Base64.Guru to convert files
to base64
and compare the base64
result each time for each type.
the MIME-TYPE
is the same UEsDBBQABgAI
, there is no indicator or rule to distinguish between them,
any ideas ?