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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T08:50:10+00:00 2026-05-21T08:50:10+00:00

I am running running a script which moves an uploaded file with move_uploaded_file() .

  • 0

I am running running a script which moves an uploaded file with move_uploaded_file(). I have done this thousands of times but for some reason it’s not working. I have confimred the following:

  1. <form> using method="post" and correct enctype
  2. correct file referenced from form
  3. directory has permissions 777
  4. all the memory_limit, max_execution_time, etc are set to super high settings to avoid timeouts

Basically, the script below returns with just Your image is too big.. I have also enabled ALL errors to display and still don’t get an error. Any ideas?

$time = time();
$target_path = "/absolute/path/to/temp/directory/temp/";

$target_path = $target_path.$time.'.jpg'; 

if(move_uploaded_file($_FILES['image']['tmp_name'], $target_path)) {            

} else{
        $error .= '<li>Your image is too big.</li>';
}

Using 1and1 hosting with the php.ini hack 😛

UPDATE 1

I would like to add that response from the script occurs exactly after 60 seconds.

UPDATE 2

We might be getting somewhere with this. Just print_r($_FILES) and this is the result of the array:

Array ( 
    [image] => Array ( 
        [name] => P2120267.JPG 
        [type] => 
        [tmp_name] => 
        [error] => 1 
        [size] => 0 
    ) 
) 

So that leads me to believe that the file isn’t be uploaded correctly to the server or something? I have checked and the post form is <form action="" method="post" enctype="multipart/form-data">. So, from what I can tell, the file isn’t being uploaded to the server’s temp area?

UPDATE 3

Noticed the [error] => 1 in the above array. This is apparently down to the filesize being larger than the upload_max_filesize. However, when i set this as 128M, I get a white screen of death after 60 seconds. The file I’m uploading is 2.5MB

Here is my php.ini file:

register_globals=off
memory_limit = 128M 
max_execution_time=3600 
post_max_size = 128M
upload_max_filesize= 128M 

UPDATE 4

With details above, it appears that I am getting a WSOD, but the image is being upoaded. So, how to stop the WSOD? I can’t find any errors related anywhere.

UPDATE 5 – FOUND IT!

Shame on me for not giving you guys all the code. It looks like its to do with this line:

resizeImage($feedBurnerStatsSource, PHOTOMSGDIR.'temp/'.$time.'-tmp.jpg',$width,$height);

In the following code:

function resizeImage($source, $destination = NULL,$wdt, $height = NULL){
    if(empty($height)){
            // Height is nit set so we are keeping the same aspect ratio.
            list($width, $height) = getimagesize($source);
            if($width > $height){
                    $w = $wdt;
                    $h = ($height / $width) * $w;
                    $w = $w;
            }else{
                    $w = $wdt;
                    $h = $w;
                    $w = ($width / $height) * $w;
            }
    }else{
            // Both width and Height are set.
            // this will reshape to the new sizes.
            $w = $wdt;
            $h = $height;
    }
    $source_image = @file_get_contents($source) or die('Could not open'.$source);
    $source_image = @imagecreatefromstring($source_image) or die($source.' is not a valid image');
    $sw = imagesx($source_image);
    $sh = imagesy($source_image);
    $ar = $sw/$sh;
    $tar = $w/$h;
    if($ar >= $tar){
            $x1 = round(($sw - ($sw * ($tar/$ar)))/2);
            $x2 = round($sw * ($tar/$ar));
            $y1 = 0;
            $y2 = $sh;
    }else{
            $x1 = 0;
            $y1 = 0;
            $x2 = $sw;
            $y2 = round($sw/$tar);
    }
    $slate = @imagecreatetruecolor($w, $h) or die('Invalid thumbnail dimmensions');
    imagecopyresampled($slate, $source_image, 0, 0, $x1, $y1, $w, $h, $x2, $y2);
    // If $destination is not set this will output the raw image to the browser and not save the file
    if(!$destination) header('Content-type: image/jpeg');
    @imagejpeg($slate, $destination, 75) or die('Directory permission problem');
    ImageDestroy($slate);
    ImageDestroy($source_image);
    if(!$destination) exit;
    return true;
}

So, WSOD means that its some sort of die without a message. Any ideas?

  • 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-21T08:50:11+00:00Added an answer on May 21, 2026 at 8:50 am

    Just to verify is the post_max_filesize set to a high level? Because according to php.net:

    If the size of post data is greater than post_max_size, the $_POST and $_FILES superglobals are empty. This can be tracked in various ways, e.g. by passing the $_GET variable to the script processing the data, i.e. <form action="edit.php?processed=1">, and then checking if $_GET['processed'] is set.

    Something to consider.

    for more info see this link and scroll down to the post_max_filesize section

    UPDATE

    In my experience if you’re getting a WSOD it’s usually do to error_reporting and display_errors being turned off OR the memory_limit being reached. In the script at the top I usually set the memory_limit to 1024M to verify that isn’t the problem and the turn on error_reporting and display_errors… so put this before the file upload:

    error_reporting(E_ALL); // or E_STRICT
    ini_set("display_errors",1);
    ini_set("memory_limit","1024M");
    

    That normally gets rid of the WSOD and gives you and error to work with.

    UPDATE

    Have you tried taking off the @ error suppression in front of all your functions to see they are producing a specific error? Also what are you execution and input timeouts? and Can you verify what headers are being sent? (make sure it is Content-Type=text/html;)

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

Sidebar

Related Questions

I'm running an xcopy command in a batch script which copies a file to
I've got a PHP script which I'm running from a command line (windows) that
I have a PHP script (running on a Linux server) that ouputs the names
I've had some trouble forking of processes from a Perl CGI script when running
I am running ruby script/generate scaffold or ruby script/generate model and I know the
What is the best way to keep a PHP script running as a daemon,
A typical approach to avoid two instances of the same script running simultaneously looks
A python script is running two parallel python processes ( created via os.fork() )
I'm running an upgrade script against a database hosted in Microsoft SQL Server. It's
I'm trying to ensure a script remains running on a development server. It collates

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.