// -- 上传图片表单
<form name=form method=post ENCTYPE="multipart/form-data" action="$adminfile_url" onsubmit="return checkempass(this);"> <input type=hidden name="action" value="add_pro"> <input type=hidden name="id" value="$id"> <input type=hidden name="cid" value="$cid">產品圖案:(小)</td><td><input type="hidden" name="max_file_size" value="200000"> <input type=file name="image_small"> </td></tr><tr><td align=center valign=top><INPUT type="submit" value="新增產品" STYLE="COLOR:FFFFFF;HEIGHT:22PX;BACKGROUND-COLOR:#FF9900;BORDER:1 SOLID FFFFFF"> <INPUT type="reset" value="清除重填" STYLE="COLOR:FFFFFF;HEIGHT:22PX;BACKGROUND-COLOR:#FF9900;BORDER:1 SOLID FFFFFF"> <INPUT type="button" value="回上一頁" onclick="location.href='javascript:history.back(1)'" STYLE="COLOR:FFFFFF;HEIGHT:22PX;BACKGROUND-COLOR:#FF9900;BORDER:1 SOLID FFFFFF"> </td></form></tr></table> EOT; }echo <<<EOT
</td></tr></table>
</body>
</html>
EOT;
exit;
}
//--图片上传处理程序
//$image_small_name=$HTTP_POST_FILES['image_small']['name'];
//$image_small_tmp_name=$HTTP_POST_FILES['image_small']['tmp_name'];
//echo "<br>image_small=$image_small";
//echo "<br>name=$image_small_tmp_name";if ($image_small != 'none' && $image_small != '') { if ($image_small_size == 0) { unlink($image_small); $error_msg= "上傳的 $image_small_name 圖片檔案, 是 0kb."; admin_error($error_msg); } if ($image_small_type != "image/jpg") { if ($image_small_type != "image/gif") { if ($image_small_type != "image/pjpeg") { if ($image_small_type != "image/jpeg") { unlink($image_small); $error_msg= "上傳的 $image_small_name 圖片檔案格式錯誤.";
admin_error($error_msg);
}
}
}
}
if (file_exists("$pro_image_path/$image_small_name")) { unlink($image_small); $error_msg= "$image_small_name 圖片名稱重覆.";
admin_error($error_msg);
}
}//if ($image_small != 'none' && $image_small != '') {
if(isset($image_small) and is_uploaded_file($image_small)) move_uploaded_file($image_small, "$pro_image_path/$image_small_name");
chmod("$pro_image_path/$image_small_name", 0777); unlink($image_small); //}