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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:10:14+00:00 2026-06-10T18:10:14+00:00

I want check uploading file type, tell please where way is reliable for this,

  • 0

I want check uploading file type, tell please where way is reliable for this, in where case obtain I more exactly info about file type? in this:

$_files['uploaded_file']['type']

or in this:

$imgType = getimagesize($_files['uploaded_file']['tmp_name']);
$imgType['mime'];

?

  • 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-10T18:10:16+00:00Added an answer on June 10, 2026 at 6:10 pm

    $_FILES['uploaded_file']['type'] is user input – it is an arbitrary string defined by the client. It is therefore not safe to use for anything at all, ever.

    getimagesize() is a much safer way to do it, but it does not protect you completely.

    You also need to:

    • Store the file on your local server with a name completely of your own devising. It is not safe to rely on any user input for generating local file system file names.
    • Use GD to copy the pixel data from the source file to the destination file. getimagesize() only looks at the meta data associated with the file and does not look at the file data. It is possible to hide malicious code inside something that looks like an image. Once you have resampled the image, ensure the uploaded file is deleted from the server.
    • Ensure that the file is stored in the local file system with the minimum required permissions and a restrictive owner/group.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to check the file size before uploading it, so that i can
I want to validate the file type to make sure the user is uploading
I want to check a particular file exist in Azure Blob Storage. Is it
I want to check whether any Zip file is present on a specified path.
I want to get file size I'm doing this: my $filename=$query->param(upload_file); my $filesize =
I want to check if there is a directory exist or not before uploading
What I really want to do is check if the same file exists before
I am having a hard time using $_FILES I want to check if file
this the html markup for multiple upload..i want to perform validation to it.. 1)check
In my web application I have an image uploading module. I want to check

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.