413 Request Entity Too Large

I’m working on a small site that saves png files to the server (DH shared hosting)

the files are small: 960x540

but for some reason I’m getting apache errors: 413 Request Entity Too Large

any advice on how to fix this?

thanks!

How are you trying to save those files to the server, and how large are they (in terms of file size)?

Hi Andrew

filesize - they range from 96kb to 300kb
all are 960 x 540 pixels PNG files

I’m using the following code to save to the server

<?php
if (isset($_POST["image"]))
{
// Get the data like you would with traditional post
$rawImage=$_POST["image"];
// Remove the headers  
$removeHeaders=substr($rawImage, strpos($rawImage, ",")+1);

// decode it from base 64 and into image data only
$decode=base64_decode($removeHeaders);

// save to your server
$fname = "temp/".uniqid("img").".png";
$fopen = fopen($fname, 'w' );
fwrite( $fopen, $decode);
fclose( $fopen );

print $fname;

}
?>

I’d try PHP 5.4