case '8': $error = '上傳失敗,File upload stopped by extension'; break; case '999': default: $error = '上傳失敗,錯誤代碼999!'; } } elseif (empty($_FILES[$fileElementName]['tmp_name']) || $_FILES[$fileElementName]['tmp_name'] == 'none') { $error = '並無上傳任何檔案!'; } else { if (!$sam->image_check($_FILES[$fileElementName]['type'], $pic_jpg, $pic_gif, $pic_png)) { $error = '圖片上傳格式有誤!'; } elseif (empty($cid)) { $error = '未選擇顏色!'; } else { $img = new img_uploader(); $img->set_path($_FILES[$fileElementName]); //置入路徑 $img->set_width($pic_width); //決定大圖大小 $img->set_savepath("../../images/" . date("Y-m-d")); //設定儲存路徑 $pic = $img->save(); //儲存大圖 $msg .= " File Name: " . $_FILES[$fileElementName]['name'] . ", "; $msg .= " File Size: " . @filesize($_FILES[$fileElementName]['tmp_name']); } //for security reason, we force to remove all uploaded file @unlink($_FILES['fileToUpload']); } } else {
$img->set_path($_FILES['bg_file']); //置入路徑 $img->set_width($_POST['pic_width']); //決定縮圖大小,大圖大小 $img->set_savepath("../images/file"); //設定儲存路徑 $pic_bg = $img->save("bg"); } //預設圖片處理 if ($_FILES['no_pic_file']['size'] == 0) { $pic_no_pic = $_POST['pic_no_pic']; } else { if (!$tool->image_check($_FILES['no_pic_file']['type'], $_POST['pic_jpg'], $_POST['pic_gif'], $_POST['pic_png'])) { $tool->error("背景圖片檔案格式有誤!"); } $img = new img_uploader(); $img->set_path($_FILES['no_pic_file']); //置入路徑 $img->set_width($_POST['pic_width']); //決定縮圖大小,大圖大小 $img->set_savepath("../images/file"); //設定儲存路徑 $pic_no_pic = $img->save("add"); } $sql = "UPDATE `{$now_table}` SET \n`pic_quality` = '" . $sam->var_check($_POST['pic_quality']) . "',\n`pic_width` = '" . $sam->var_check($_POST['pic_width']) . "',\n`pic_width_small` = '" . $sam->var_check($_POST['pic_width_small']) . "',\n`pic_bg` = '" . $pic_bg . "',\n`pic_bg_w` = '" . $sam->var_check($_POST['pic_bg_w']) . "',\n`pic_bg_h` = '" . $sam->var_check($_POST['pic_bg_h']) . "',\n`pic_no_pic` = '" . $pic_no_pic . "',\n`pic_max_size` = '" . $sam->var_check($_POST['pic_max_size']) . "',\n`pic_jpg` = '" . $sam->var_check($_POST['pic_jpg']) . "',\n`pic_gif` = '" . $sam->var_check($_POST['pic_gif']) . "',\n`pic_png` = '" . $sam->var_check($_POST['pic_png']) . "',\n`f_show` = '" . $sam->var_check($_POST['f_show']) . "',\n\n`f_show_new` = '" . $sam->var_check($_POST['f_show_new']) . "',\n`f_show_commend` = '" . $sam->var_check($_POST['f_show_commend']) . "',\n`f_show_sp` = '" . $sam->var_check($_POST['f_show_sp']) . "',\n\n`f_line` = '" . $sam->var_check($_POST['f_line']) . "',\n`f_pic_w` = '" . $sam->var_check($_POST['f_pic_w']) . "',\n`f_pic_h` = '" . $sam->var_check($_POST['f_pic_h']) . "',\n`f_pic_sw` = '" . $sam->var_check($_POST['f_pic_sw']) . "',\n`f_pic_sh` = '" . $sam->var_check($_POST['f_pic_sh']) . "',\n`f_order` = '" . $sam->var_check($_POST['f_order']) . "',\n`file_info` = '" . $_POST['file_info'] . "'\n WHERE `" . $now_table . "`.`id` =1 "; mysql_query($sql); } //更新資料END---------------------------------------------------------------- //***************************取出原設定********************************** $sql = "select * from `{$now_table}` where id=1"; $row = mysql_fetch_array(mysql_query($sql));
$tool->error("未選擇類別!"); } } if (empty($id) and $check != "add") { $tool->error("參數錯誤,未指定產品!"); } if ($_FILES['upload']['size'] != 0 and !$sam->image_check($_FILES['upload']['type'], $pic_jpg, $pic_gif, $pic_png)) { $tool->error("圖片檔案格式有誤!"); } if ($_FILES['upload']['size'] > $pic_max_size) { $tool->error("檔案大小超過限制!"); } //檢查完畢--------------------------- //處理圖檔上傳--------------------------- if ($_FILES['upload']['size'] > 0) { $img = new img_uploader(); $img->set_path($_FILES['upload']); //置入路徑 $img->set_width($pic_width); //決定縮圖大小,大圖大小 $img->set_savepath("../images/" . date("Y-m-d")); //設定儲存路徑 $pic = $img->save(); } else { $pic = $_POST['pic']; } //處理完畢------------------------------ //ADD PRODUCTS if ($check == 'add') { $unit->get_vars(); //取得所有post資料
include "pic_unit.php"; // Work-around for setting up a session because Flash Player doesn't send the cookies if (isset($_POST["PHPSESSID"])) { session_id($_POST["PHPSESSID"]); } ini_set("html_errors", "0"); // Check the upload if (!isset($_FILES["Filedata"]) || !is_uploaded_file($_FILES["Filedata"]["tmp_name"]) || $_FILES["Filedata"]["error"] != 0) { echo "上傳錯誤 : 無效的檔案 "; exit(0); } //System----------------------------------------------------------- $now_table = $pro_pic_table; //System----------------------------------------------------------- $unit = new pic(); $img = new img_uploader(); $img->set_path($_FILES["Filedata"]); //置入路徑 $img->set_width($pic_width); //決定大圖大小 $img->set_savepath("../../images/" . date("Y-m-d")); //設定儲存路徑 $pic = $img->save(); $img->set_width($pic_width_small); //決定縮圖大小 $img->set_savepath("../../images/" . date("Y-m-d")); //設定儲存路徑 $s_pic = $img->save(); //儲存縮圖 $pic = substr($pic, 3); $s_pic = substr($s_pic, 3);