Upload Image/Photo Not Working PHP Version 5.3.3-7+squeeze14 and Devian
<p>I cannot upload image/photo with PHP version 5.3.3.7 Devian. Please see code below:</p>

<pre><code>function _handlePhoto($id) {
    //echo "&lt;pre&gt;" . print_r($_FILES, true) . "&lt;/pre&gt;";
    if(isset($_FILES['photo']) &amp;&amp; $_FILES['photo']['tmp_name']) {
        if(!($this-&gt;validation-&gt;writable_directory(array('images/photos/large','images/photos/medium','images/photos/small'))
                )) {
            $this-&gt;load-&gt;view("error", array('error' =&gt; "Error: ".$this-&gt;validation-&gt;error_string));
        }
        $pu = new Photo_upload($this);
        $_POST["hasPhoto"] = $pu-&gt;upload_photo($_FILES['photo']['tmp_name'],$id);
        //print_r($_FILES['photo']['tmp_name']);
        return $_POST['hasPhoto'];
    }
</code></pre>

<p><strong>Am using a plugin php file with code below:</strong></p>

<pre><code>class Photo_upload {
    var $CI;

function Photo_upload(&amp;$instance) {
    $this-&gt;CI = $instance;
    $this-&gt;CI-&gt;load-&gt;library("image_lib");
    $this-&gt;CI-&gt;load-&gt;helper('file');
}

function upload_photo($filename, $id) {
    $opts["small"] = array(125,94);
    $opts["medium"] = array(200, 150);
    $opts["large"] = array(400, 300);
    foreach($opts as $size =&gt; $dimensions) {
        $this-&gt;resize_image($filename, "images/photos/${size}/${id}.jpg",$dimensions[0],$dimensions[1]);
    }
    unlink($filename);
    //print_r(array("upload_photo",$filename, $id));
    return true;
}

function resize_image($source_filename, $destination_filename, $height, $width, $keep_ratio = true) {
    //resize the image        
    $opt["image_library"] = 'GD2';
    $opt["source_image"] = $source_filename;
    $opt["new_image"] = $destination_filename;
    $opt["maintain_ratio"] = $keep_ratio;
    $opt["height"] = $height;
    $opt["width"] = $width;
    $this-&gt;CI-&gt;image_lib-&gt;clear();
    $this-&gt;CI-&gt;image_lib-&gt;initialize($opt);
    $this-&gt;CI-&gt;image_lib-&gt;resize();

//rotate the image, if necessary
$s = getimagesize($destination_filename);
$w = $s[0];
$h = $s[1];
if($w &gt; $h) {
    unset($opt);
    $opt["image_library"] = 'GD2';
    $opt["source_image"] = $destination_filename;
    $opt['rotation_angle'] = 270;
    //$opt['dynamic_output'] = true;
    //$opt['new_image'] = $destination_filename;
    $this-&gt;CI-&gt;image_lib-&gt;clear();
    $this-&gt;CI-&gt;image_lib-&gt;initialize($opt);
    if(!$this-&gt;CI-&gt;image_lib-&gt;rotate()) $this-&gt;CI-&gt;image_lib-&gt;display_errors('&lt;pre&gt;','&lt;/pre&gt;');
}

}

}
</code></pre>

<p><strong>Am getting no errors. Please help. Thanks in advance.</strong> </p>
