Get exact file extension even after rename

15 pts.
File extension
I am trying to make a web application where I want to validate the file extension even after name change on File Upload Control, I did some research and found Dataview solution but it is still with some lack since I found extension doc, xls, msi with the same Header Signature. If you can help me out with this it would be great. I can't use server side code since it has to be validate before uploading file. My main Goal is to Prevent the User from Uploading the Wrong File Type on any Condition.

Answer Wiki

Thanks. We'll let you know when a new response is added.
❖Identifying Files that don’t have an Extension
If a file doesn’t have an extension, you can still identify the format of that file from its signature. All known file types have a standard and unique signature and this data is stored in the file itself. There are programs that can read this signature* and determine the file format even if the extension is missing from the file name.
The most popular program in the category of file identifiers is TrIDNet  
First download and unzip the TrIDNet utility and the associated XML definition files in the same directory. Then open the TrIDNet.exe file, press the “Rescan Defs” button to load the file signatures (you only need to do this once) and then drag-drop any unknown files that you wish to analyze.It will show the different file types that match with the file’s signature and you can then use Wolfram Alpha again to learn about the different programs that can be used to open that particular file type. Do remember to rename the files after identification (press F2, prefix a dot with the extension).

Discuss This Question: 2  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Subhendu Sen
    More information is needed. What server side language used there, is it VB.NET/ C#. For client side checking you can use JavaScript to fulfill the job. Are you a part of a development team? If yes, what they advised you? Have you ever asked them? Please back with more details.
    140,740 pointsBadges:
  • Anynomus
    Yes I use C#., I am using File Upload Control to upload file and now I want to prevent user from posting wrong file even with rename of extension. Thanks a lot for response. I tried using file signature but so many file extension has same signature so I could not got unique way to do it.
    15 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: