Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8042981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:45:54+00:00 2026-06-05T04:45:54+00:00

While trying to come-up with a servlet based application to read files and manipulate

  • 0

While trying to come-up with a servlet based application to read files and manipulate them (image type conversion) here is a question that came up to me:

  1. Is it possible to inspect a file content and know the filetype?
  2. Is there a standard that specifies that each file MUST provide some type of marker in their content so that the application will not have to rely on the file extension constraints?

Consider an application scenario:

I am creating an application that will be able to convert different file formats to a set of output formats. Say user uploads an PDF, my application can suggest that the possible conversion formats are microsoft word or TIFF or JPEG etc.

As my application will gradually support different file formats (over a period of time), I want my application to inspect the input file instead of having the user to specify the format. And suggest to user the possible formats of output.

I understand this is an open ended, broad question. Please let me know if it needs to be modified.

Thanks,
Ayusman

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T04:45:55+00:00Added an answer on June 5, 2026 at 4:45 am

    Yeap you can figure out the type without an extension using the magic number.
    Also, the way the file command figures it out, is actually through a 3 step check:

    1. Check for filesystem properties to identifie empty files, folders, etc…
    2. The said magic number
    3. In text files, check for language in it

    Here’s a library that’ll help you with Magic Numbers: jmimemagic

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While trying out an experimental UINavigationController-based iPhone application, I ran into a problem when
I come across several problems while trying django unittests library. Something strange happens: I
While trying to execute the following lines only the last two statements are displayed(Here
So, I've had some issues while trying to come over from Latin1 encoded databases,
for a while I've been trying to come up with a good way to
Ok, I'm trying to come to grips with this nextSibling function in JS. Here's
While trying to write a custom control I've come across a problem with the
While trying to get a legacy codebase under test, I've come across an object
While trying to answer another question, I was serializing a C# object to an
I'm trying to come up with a simple example of a while loop using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.