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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:55:08+00:00 2026-05-27T08:55:08+00:00

I have a sever which people can upload files to. The problem is that

  • 0

I have a sever which people can upload files to. The problem is that some of the filenames are mangled (dont have any extension) and so I cannot immediately determine file type. This question is two part: for the files which do have filenames what is the best way to determine whether or not it is an image? (Just a big long if/else if list?) Secondly, for the files which dont have extensions, how can I determine if they are images?

  • 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-05-27T08:55:08+00:00Added an answer on May 27, 2026 at 8:55 am

    You can use exif_imagetype()

    <?php
        $type =exif_imagetype($image);
    

    where $type is a value

    1. IMAGETYPE_GIF
    2. IMAGETYPE_JPEG
    3. IMAGETYPE_PNG
    4. IMAGETYPE_SWF
    5. IMAGETYPE_PSD
    6. IMAGETYPE_BMP
    7. IMAGETYPE_TIFF_II (intel byte order)
    8. IMAGETYPE_TIFF_MM (motorola byte order)
    9. IMAGETYPE_JPC
    10. IMAGETYPE_JP2
    11. IMAGETYPE_JPX
    12. IMAGETYPE_JB2
    13. IMAGETYPE_SWC
    14. IMAGETYPE_IFF
    15. IMAGETYPE_WBMP
    16. IMAGETYPE_XBM
    17. IMAGETYPE_ICO

    From the manual:

    When a correct signature is found, the appropriate constant value will be returned otherwise the return value is FALSE. The return value is the same value that getimagesize() returns in index 2 but exif_imagetype() is much faster.

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

Sidebar

Related Questions

I have sever JPanels which have to be ordered vertically. For that I want
I have an Android application from which I want to upload some data to
I have a page where i can actually upload files to 3 folders. I
The usual case. I have a simple app that will allow people to upload
We have an asp app on which people can take tests. On the test
I have a web page which I want people to be able to upload
I'm making a website which allows people to upload files, html pages, etc... Now
I am running some code that I have written in C which calls the
I have a flex application which is configured with blazeds sever and i am
I have a web server which saves cache files and keeps them for 7

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.