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

  • Home
  • SEARCH
  • 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 1088795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:07:28+00:00 2026-05-16T23:07:28+00:00

I make a php script that receive from POST 4 image, than store them

  • 0

I make a php script that receive from POST 4 image, than store them and create the thumbs trought GD php library. The problem is that it works only if i load 2 photos 4mb each (or 4 photos 2 mb each, or less; in fact max 8 mb). why? i check the value of memory_limit (64mb), upload_max_filesize (25mb) and max_file_uploads (120secs), and if i increase them, nothing happen.

It seems that POST array is totally ignored : i see this because i put some “echo” on php script. The code is above :

if(($_FILES['userfile1']['tmp_name']!="") or ($_FILES['userfile2']['tmp_name']!="") or ($_FILES['userfile3']['tmp_name']!="") or ($_FILES['userfile4']['tmp_name']!="")) {
    // JPG/JPEG, max 4mb each
    for($i=1; $i<=4; $i++) {
        if ($_FILES['userfile'.$i]['tmp_name']!="") {
            $path_parts=pathinfo($_FILES['userfile'.$i]['name']);
            if(((strtolower($path_parts['extension'])=='jpg') or (strtolower($path_parts['extension'])=='jpeg')) 
            && ($_FILES['userfile'.$i]['size']<=4194304)) {
            } else {
                $wrong=1;
            }
        }
    }

    if(isset($wrong)) {
        $abort=1;
        $messaggio="Errore - Formato delle foto non valido. Assicurati che il formato sia jpg/jpeg e che la foto non superi i 3 Megabyte";
    } else {
        mkdir("./articles/photos/".$articleid);
        mkdir("./articles/photos/thumbs/".$articleid);
        $sql="";
        for($i=1; $i<=4; $i++) {
            if ($_FILES['userfile'.$i]['tmp_name']!="") {
                $photoid=$articleid."-".$i;
                $uploaddir="./articles/photos/".$articleid."/";
                $userfile_tmp=$_FILES['userfile'.$i]['tmp_name'];   
                $userfile_name=$_FILES['userfile'.$i]['name'];

                $userfile_name=$photoid."@".trim(str_replace(" ", "", $_FILES['userfile'.$i]['name']));

                $path_parts=pathinfo($_FILES['userfile'.$i]['name']);
                $photoondb=$photoid.".".strtolower($path_parts['extension']);
                move_uploaded_file($userfile_tmp, $uploaddir.$photoondb);

                // thumbs
                $name_new_image="./articles/photos/thumbs/".$articleid."/".$photoondb;
                $file = "./articles/photos/".$articleid."/".$photoondb;

                list($actualw, $actualh, $type, $attr) = getimagesize($file);
                if(($actualw>100) or ($actualh>100)) {
                    if($actualw>$actualh) {
                        $v1=$actualw/100;
                        $width=$actualw/$v1;
                        $height=$actualh/$v1;
                    } else {
                        $v1=$actualh/100;
                        $width=$actualw/$v1;
                        $height=$actualh/$v1;
                    }
                }
                $qualita=70;
                $new_image=imagecreatetruecolor($width, $height);
                $src_image=imagecreatefromjpeg($file);
                imagecopyresampled($new_image, $src_image, 0, 0, 0, 0, $width, $height, imagesx($src_image), imagesy($src_image));
                imagejpeg($new_image, $name_new_image, $qualita);

                imagedestroy($new_image);
                imagedestroy($src_image);

                if($sql!="") $sql.=", ";
                $sql.="('$articleid', '$photoondb')";
            }
        }
    }
}

I hope you can understand what i mean, more or less 🙂

  • 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-16T23:07:30+00:00Added an answer on May 16, 2026 at 11:07 pm

    you missed one more parameter: post_max_size. its default is 8M…

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

Sidebar

Related Questions

I would like to make a php script that can capture a page from
I'm trying to make a PHP script that will take a potentially infinite number
I'm trying to make a PHP script that will check the HTTP status of
I was wondering how to make a php daemon script that runs one time
I want to make a button that starts my php script after I click
I have a PHP upload script and am trying to make it so that
I'm trying to make a simple php script to find all src attributes from
I'm attempting to make a php script that can load the current weather forecast
I have a PHP script that creates an xml file from the db. I
I'm trying to make a script that sends a file from my server to

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.