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 8521717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:54:20+00:00 2026-06-11T06:54:20+00:00

Hi everybody who is kind enough to read this. Im working with a Java

  • 0

Hi everybody who is kind enough to read this.

Im working with a Java program, i didnt make it, but im refining it , the problem it’s that you can add files , but i want to validate so the added files are not compressed in any human known format so i dont want the people to be able to add a zip file or rar or 7z or gz , an so on.

can anyone help me with a idea, it’s this even possible?

thanks in advance.

*Edit:
The program its used by IT students , they add the files (.java,.class, .php, .doc, .mdb) of their source code, the paths are saved in strings, and at the end, the program zips the files, and send them to the teacher, know the instructor doesn’t want to receive zipped or compressed files, that’s the reason of the validation.

  • 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-11T06:54:21+00:00Added an answer on June 11, 2026 at 6:54 am

    You basically do the java equivalent of the unix command type on the file’s bytes. Most files have an embedded fingerprint which gives hints to other programs as to what type of file it is. This fingerprint is typically called a “magic number”

    7zip - '7', 'z', 0xBC, 0xAF, 0x27, 0x1C
    gzip - 0x1F, 0x8B
    

    One (incomplete) list of magic numbers can be found here.

    Some files don’t have magic numbers, in which case you have to look for other common items in the file which strongly hints it’s a file of the suspected type.

    Relying on file name extensions will just have everyone eventually renaming the extension.

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

Sidebar

Related Questions

Dear everybody who can help, I have this PHP > MongoDB problem, I want
Hi everybody and thanks for your time, I read filenames in a QList. This
Update: Thanks a lot to everybody who responded!!! It made me feel that I'm
I'm working on this problem for several days. I have a oracle database. The
everybody! I'm working on some kind of an event calendar and I am using
I have to do a Java program that contains a panel with an image
Everybody knows that a list of numbers can be obtained with range like this;:
everybody! Could I ask you to help me to decode this JSON code: $json
Hello everybody my linq to sql selection does not working on dateTime field for
Hi everybody. The problem: elcipse-3.5.0 (Galileo) spits with an error when I try to

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.