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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:57:21+00:00 2026-05-15T16:57:21+00:00

I am building a website where the user can upload mp3 files. And, I

  • 0

I am building a website where the user can upload mp3 files. And, I want to check if the file is a mp3 file. What I need to know is if there is a php function that do that for me.

I tried $_FILES['uploadedfile']['type']

But, I does not work like I want, because it returns the file type based on the extension (I tested it only on windows)

So, the questions are:

  1. There is a safe way to do that with php native functions??
  2. The file type based on extension, is a php issue or is related to the OS?
  3. What do you recomend to me??

Thanks.

  • 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-15T16:57:22+00:00Added an answer on May 15, 2026 at 4:57 pm

    1- There is a safe way to do that with php native functions??

    For MP3s, not with PHP native functions, no.

    There is fileinfo that makes use of the OS’s “MIME sniffing” functionality. If installed, it’s usually pretty reliable.

    Alternatively, the getID3 library claims to be able to extract information from MP3 files. If you can get a playing time from the file, chances are it is a valid MP3 file.

    2- The file type based on extension, is a php issue or is related to the OS?

    Neither. The browser determines the file type (according to extension usually) and sends a MIME type. As with any incoming data, it is very easy to fake and can never be trusted.

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

Sidebar

Related Questions

I am building a website where i need a page where user can upload
i am building a php based website but now i need to give user
I'm building a website with Rails which can let user check if some domains
I'm building a website where users can upload images. I don't want to use
Users on a website I'm building can request the availability of user names on
I'm building a website with user generated content. On the home page I want
I am building a tiny website host service, where an user can create a
I am building a website which depends on serving lots of little mp3 files
I am building a new website where a user can login. I see three
I am building a website where I have a need that user should be

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.