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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:49:53+00:00 2026-05-26T16:49:53+00:00

I guess I want to ultimately build out a script that will force the

  • 0

I guess I want to ultimately build out a script that will force the browser in a sense to prompt for a download rather than go directly to the file and I want to do it based off of db entries so its obfuscated just that little bit more. My problem is I can only find a mime type or 2 to work with but I want a fair shares worth. From doc to pdf, to mp3 to avi.. My script is going to run based off extensions of files and then output the proper header just need to know what header to put out with what type of file. Is there a common list of file types known to stream or open within a browser by default that I can just go by?

  • 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-26T16:49:53+00:00Added an answer on May 26, 2026 at 4:49 pm

    File extensions are not exactly the most reliable way to determine the file type. You might be interested in doing some MIME guessing. If you app is hosted in Linux, you can benefit from the file command line tool with the -i option:

    // Use escapeshellarg() to inject arbitrary file paths
    $content_type = `file -i /path/to/file`;
    

    Otherwise, PHP has a PECL extension called Fileinfo.

    If you want to stick to file extensions, media types are approved by the IANA.

    Update: Fileinfo is a native extension since PHP/5.3.0 (thus no need to install a third-party app). Usage example:

    $finfo = finfo_open(FILEINFO_MIME_TYPE);
    $mime_type = finfo_file($finfo, '/path/to/file');
    finfo_close($finfo);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Guess that I have a TextView that I want to update it in some
I want a solution for tag:hover that is not working on ie6. My guess
I want to understand why the following is happening. My guess is that a
Yes, as you might guess, I want to ask about Cloud-computing. I doubt that
Everytime the user makes a wrong guess I want the label7.text to display that
I want to create some textured rectangles (I guess the jargon for this is
I want to play a .wav file on a mobile device. I guess my
Simple question I guess, I want to use PHP to write an update to
I don't want to open another Yet Another Js VS Js thread. I guess,
This is very basic magento question i guess. I want to first get all

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.