Jump to content

[SOLVED] upload over 200k doesn't work


bobinindia

Recommended Posts

 

The script is a bit long as it does some other stuff.

 

$filename = 'upload';
        $description = 'description';
        if (isset($_FILES['upload']) ) {
            if (!empty($_POST['description'])) {
                $d = "'" . escape_data($_POST['description']) . "'";
            } else {
                $d = 'NULL';
            }
            //Add the record to the database
            $query = "INSERT INTO uploads (file_name, file_size, file_type, description)
                    VALUES ('{$_FILES['upload']['name']}', '{$_FILES['upload']['size']}', '{$_FILES['upload']['type']}', $d)";
            $result = mysql_query ($query);
            
            if ($result) {
                $upload_id = mysql_insert_id();
                if (move_uploaded_file($_FILES['upload']['tmp_name'], "../../externals/uploads/$upload_id")) {
                    $picid = "../../externals/uploads/$upload_id".".jpeg";
                    
define ("WIDTH", "600");
define ("HEIGHT", "600");
$img_name = $pic_id;
function make_thumb($img_name,$filename,$new_w,$new_h)
{

$src_img=imagecreatefromjpeg($img_name);

$old_x=imageSX($src_img);
$old_y=imageSY($src_img);

$ratio1=$old_x/$new_w;
$ratio2=$old_y/$new_h;
if($ratio1 > $ratio2) {
$thumb_w=$new_w;
$thumb_h=$old_y/$ratio1;
}
else {
$thumb_h=$new_h;
$thumb_w=$old_x/$ratio2;
}

$dst_img=imageCreateTrueColor($thumb_w,$thumb_h);
imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);

imagejpeg($dst_img,$filename);
imagedestroy($dst_img);
imagedestroy($src_img);
}
$thumb_name="resized/".$upload_id.".jpeg";
$filename = $thumb_name;
$thumb=make_thumb("../../externals/uploads/$upload_id",$thumb_name,WIDTH,HEIGHT);
                    
                    copy($thumb_name, "ImageEditor/edit/$upload_id".".jpeg");
                    copy($thumb_name, "ImageEditor/original/$upload_id".".jpeg");
                    copy($thumb_name, "ImageEditor/active/$upload_id".".jpeg");
                    
                    ob_end_clean();
                    $picname = $upload_id.".jpeg";
                    header ("Location: ImageEditor/index.php?imageName=$picname");
                    
                } else {
                    echo '<p><font color="red">File number could not be moved.</font></p>';
                    $query = "DELETE FROM uploads WHERE upload_id = $upload_id";
                    $result = mysql_query($query);
                    //Add more error reporting if needed.
                    
                }
            } else {
                //I the query did not run ok
                echo '<p><font color="red">Your submission could not be completed due to system error. Ooops.</font></p>';
                //Print the query and invoke the mysql_error() function to debug.
            }
        } // end of Isset

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.