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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T12:45:00+00:00 2026-05-21T12:45:00+00:00

i have this script for an image validation. works fine with images with 500

  • 0

i have this script for an image validation. works fine with images with 500 kb or 1.5 mb for example, but if i try with images with 4mb or 6 for example, give the error Invalid format and not the “size large”. Why?

$imageData = @getimagesize($_FILES["userfile"]["tmp_name"]);

        if($imageData === FALSE || !($imageData[2] == IMAGETYPE_GIF || $imageData[2] == IMAGETYPE_JPEG || $imageData[2] == IMAGETYPE_PNG)) {
            echo "<li>Invalid format</li>";
            die();
        }
        else {
            if($_FILES["userfile"]["size"] >= 2000000) {
                echo "<li>The size large</li>";
                die();
            }
                else {
           //mystuff
}

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-21T12:45:01+00:00Added an answer on May 21, 2026 at 12:45 pm

    You might also want to check your post_max_size and upload_max_filesize in php.ini. If the files you are trying to upload are too large, then I believe the _FILES array will not be populated.

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

Sidebar

Related Questions

I have this Javascript sliding image script. It works great, but I would like
i have this script for pixelize my images the script is working but i
I have found this script that expand image when mouse is over, but when
Hy , I have this ajax code that works fine in Chrome but in
I have got this script that works fine, that allows a user to vote,
I have this script at the moment, which changes an image when a thumbnail
I have a php script that randomly generates an image. Something like this: <?php
I have this PHP script which i'm grabbing images from a directory and displaying
I have a script that loads big images into the body in this fashion
I have this script to load some images after page loading is complete I

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.