repeated warnings while trying to upload images
<pre><code>Warning: fopen() expects parameter 1 to be string, array given in /home/speedycm/public_html/speedyautos/carphoto.php on line 42

Warning: filesize() [function.filesize]: stat failed for Array in /home/speedycm/public_html/speedyautos/carphoto.php on line 43

Warning: fread(): supplied argument is not a valid stream resource in /home/speedycm/public_html/speedyautos/carphoto.php on line 43

Warning: fclose(): supplied argument is not a valid stream resource in /home/speedycm/public_html/speedyautos/carphoto.php on line 44
</code></pre>

<p>i keep getting these error messages whenever trying to upload a picture on my website and i'm not sure how to sort them out. can anyone please help? lines 36-59 read:</p>

<pre><code>$CarInfo-&gt;Load();
if ($hidaction == "addphoto")
{
    $ctrP = 0;
    foreach ($_FILES['pics'] as $pics)
    {
        if ($_FILES['pics']['name'][$ctrP] &lt;&gt; "")
        {
            if (is_uploaded_file($_FILES['pics']['tmp_name'][$ctrP]) or die("No Image: " . $_FILES['pics']['name'][$ctrP]))
            {
                $ext = substr(strrchr($_FILES['pics']['name'][$ctrP], "."), 1);
                $fp = fopen($_FILES["pics"]["tmp_name"], 'rb');
                $contents = fread($fp, filesize($_FILES["pics"]["tmp_name"]));
                fclose($fp);
                if (preg_match("/system/", $contents) OR preg_match("/&lt;\?/", $contents))
                {
                    $error .= "Invalid image: {$_FILES['pics']['name'][$ctrP]}&lt;br /&gt;";
                    //$pieces = explode(".", $_FILES['pics']['name'][$ctrP]);
                    //$ext = $pieces[count($pieces) - 1];
                } elseif ((in_array($ext, $types_array)) AND ($_FILES['pics']["size"][$ctrP] &lt; (MAXFILE_SIZE * 1000000)))
                {
                    $orgImageName = "cid" . $property_id . "_" . str_replace(" ", "_", $_FILES['pics']['name'][$ctrP]);
                    $thmImageName = "thumb_cid" . $property_id . "_" . str_replace(" ", "_", $_FILES['pics']['name'][$ctrP]);
                    $dtlImageName = "dtl_cid" . $property_id . "_" . str_replace(" ", "_", $_FILES['pics']['name'][$ctrP]);
</code></pre>

<p>many thanks in advance and sorry for the wild indentation btw :-)</p>
