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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:38:44+00:00 2026-05-31T19:38:44+00:00

I would like to do below validations for single file uploaded using jQuery Uploadify

  • 0

I would like to do below validations for single file uploaded using jQuery Uploadify plugin.

  1. Check for the file type .jpg, .png & .gif
  2. Check for the file size maximum 2MB only

I have done this through fileExt & sizeLimit options, but as the plugin developer says, one can easily bypass the fileExt validation & server side validation is recommended.

I want to do this using PHP server side scripting language.

I have already checked the documentation of the plugin & nothing helpful found there.
Can someone please suggest how to do this ?

Thanks in advance.

  • 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-31T19:38:45+00:00Added an answer on May 31, 2026 at 7:38 pm

    I would recommend using the filesize and exif_imagetype functions to assess the file. The following should point you in the right direction:

    $up_file = "file_the_user_uploaded";
    $two_mb = 2097152;
    if (filesize($up_file) < $two_mb) {
        if (exif_imagetype($up_file) > 0 && exif_imagetype($up_file) < 4) {
            // the file is .gif, .jpg, or .png and less than 2MB
            // do something to approve the file upload
        }
    }
    

    Note that the filesize() function in PHP returns the size in bytes, thus, the file should be less than $two_mb bytes. Also, the exif_imagetype() returns an integer code mapping to the MIME type of the uploaded image: 1, 2, 3, being .gif, .jpg, and .png respectively.

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

Sidebar

Related Questions

I have been using the JEditable plugin for JQuery and I would like to
I would like to solve rounding mechanism by using php4,5.2 and below (not 5.3)
I would like to implement a parallel version of the code below using threads
I've got a simple HTML file upload form. I'm using the jQuery validation plugin
I am using client side validation and I would like the message below to
I have an alphanumeric string like below, $string_1 = a4nas60dj71wiena15sdl1131kg12b and would like to
I would like to convert the below foreach statement to a LINQ query that
I would like to know how to modify the below code to strip =20
I would like to place my div below the list, but actually it is
I would like to add a typing speed indicator just below the textarea we

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.