Results 1 to 2 of 2

Thread: [2005] determine file type without extension

  1. #1

    Thread Starter
    Frenzied Member vbdotnetboy's Avatar
    Join Date
    Jun 2004
    Location
    Lewisburg, PA "Next year Raiders in the Super Bowl"
    Posts
    1,310

    Question [2005] determine file type without extension

    does anyone know of a way to determine the type of file without using the file extension? i know there must be a way because this one particular application call ApplicationXtender does this with files. it changes a files extension to a .bin for displaying the image or document, it also changes the name of the file to an id that it stores in the database. if you know which file the id belongs to you can change the file extension to lets say .tif, .pdf, or even .doc and it will work. so i'm assuming that this application is looking at the binary data that's in the file or using some kind of mime functionality to determine the file type.

    Derek - Using VS 2008 99% of the time and VS 2003 1% of the time

    Please Help Us To Save Ana

    ● Helpful Links: DNR TV | Awesome site for tips | Using ADO.NET to work with Excel | Xml Namespace 2.0 Framework Changes|Ultra High Security Password Generator | Mendhak's ADO.NET Tutorial
    ● Code Bank: Random Password Generator | Generic DbProviderFactory Access
    ● Site Work: Bottle Run Xtreme | Spaids Racing.com

    Company I work for - CSSI

    WHEN POSTING PLEASE INDICATE VERSION

    Please use vbcode tags or code tags when posting code
    [highlight=vb]ALL your code goes here[/highlight] or [code]ALL your code goes here[/code]

    If my post helped you in anyway... please be kind and give me some ratings

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] determine file type without extension

    All file formats have a format. If you know what that format is then you can test for it and, if you find it, you can then assume that the file is that format. You need to know the format for every file type you want to be able to identify.

    I could be wrong but from what you've said I'd guess that this ApplicationXtender probably stores a file's type in its database before changing the extension. It then uses that information to identify the format instead of the actual extension.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width