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
每當試圖在我的網站上上傳圖片時我都會收到這些錯誤消息,而且我不知道如何將它們整理出來。任何人都可以請幫忙?線36-59讀:嘗試上傳圖片時重複發出警告
$CarInfo->Load();
if ($hidaction == "addphoto")
{
$ctrP = 0;
foreach ($_FILES['pics'] as $pics)
{
if ($_FILES['pics']['name'][$ctrP] <> "")
{
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("/<\?/", $contents))
{
$error .= "Invalid image: {$_FILES['pics']['name'][$ctrP]}<br />";
//$pieces = explode(".", $_FILES['pics']['name'][$ctrP]);
//$ext = $pieces[count($pieces) - 1];
} elseif ((in_array($ext, $types_array)) AND ($_FILES['pics']["size"][$ctrP] < (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]);
提前很多感謝和抱歉野生壓痕BTW :-)
我改進了你的野生縮進。 – Anomie 2011-03-22 02:19:52
謝謝!你是怎麼做到的? – methuselah 2011-03-22 02:30:36
縮進4個空格。沒有標籤。 – Anomie 2011-03-22 02:31:21