$up_thumb_height = empty($thumb_height) ? $_sys['thump_height'] : intval($thumb_height); $pic_cate = $_POST['pic_cate']; if (is_array($_FILES['up']['tmp_name'])) { foreach ($_FILES['up']['tmp_name'] as $k => $v) { if (empty($v)) { continue; } $value_arr = array(''); $pic_info = array(''); //有图上传图片 if (is_uploaded_file($v)) { $pic_info['tmp_name'] = $v; $pic_info['size'] = $_FILES['up']['size'][$k]; $pic_info['type'] = $_FILES['up']['type'][$k]; $pic_info['name'] = $_FILES['up']['name'][$k]; $value_arr = up_img($pic_info, $_sys['upload_size'], array('image/gif', 'image/jpeg', 'image/png', 'image/jpg', 'image/bmp', 'image/pjpeg', 'image/x-png'), $up_is_thumb, $up_thumb_width, $up_thumb_height, $logo = 1); //处理上传后的图片信息 $pic_name = $value_arr['up_pic_name']; //图片名称空 $pic_ext = $value_arr['up_pic_ext']; //图片扩展名 $pic_title = $pic_alt[$k]; //图片描述 $pic_size = $value_arr['up_pic_size']; //图片大小 $pic_path = $value_arr['up_pic_path']; //上传路径 $pic_time = $value_arr['up_pic_time']; //上传时间 $pic_thumb = $value_arr['thumb']; //缩略图
<script type="text/javascript" src="template/images/jquery.js"></script> <style type="text/css"> body{background:#edf2fa; margin:20px;} </style> </head> <body> <?php if (isset($_FILES['up'])) { if (is_uploaded_file($_FILES['up']['tmp_name'])) { if ($up_type == 'pic') { $is_thumb = empty($_POST['thumb']) ? 0 : $_POST['thumb']; $thumb_width = empty($_POST['thumb_width']) ? $_sys['thump_width'] : intval($_POST['thumb_width']); $thumb_height = empty($_POST['thumb_height']) ? $_sys['thump_height'] : intval($_POST['thumb_height']); $logo = 0; $value_arr = up_img($_FILES['up'], $_sys['upload_size'], array('image/gif', 'image/jpeg', 'image/png', 'image/jpg', 'image/bmp', 'image/pjpeg'), $is_thumb, $thumb_width, $thumb_height, $logo); $pic = $value_arr['pic']; if (!empty($value_arr['thumb'])) { $pic = $value_arr['thumb']; } $str = "<script type=\"text/javascript\">\$(self.parent.document).find('#{$get}').val('{$pic}');self.parent.tb_remove();</script>"; echo $str; exit; } //图片上传 } else { die('没有上传文件或文件大小超过服务器限制大小<a href="javascript:history.back(1);">返回重新上传</a>'); } } ?> <form name="up" action="" method="post" enctype="multipart/form-data">
"> <input type="hidden" name="usage" value="1"> <input type="hidden" name="id" value="<?php echo $id; ?> "> <input type="submit" name="Submit" value="submit" class="stbtm2"> <input type="reset" name="Submit2" value="reset" class="stbtm2"> </td> </tr> </table> </form> <?php } else { $name = addslashes(trim($name)); $descript = addslashes(trim($descript)); $image_file = up_img($image, $image_type); if (isset($up_id)) { switch ($action) { case "insert": $str_sql = "insert into {$goods_t}\n \t values (null,'{$up_id}','{$name}','{$descript}','{$image_file}',\n \t '{$price_m}','{$price}','{$state}','{$date}')"; break; case "update": if ($image_file) { $tmp = "image='{$image_file}',"; } $str_sql = "update {$goods_t} set up_id={$up_id},\n\t\t ,name='{$name}',descript='{$descript}',{$tmp}\n \t price_m={$price_m},price={$price},state={$state},date='{$date}'\n \t where id={$id}"; } } $db->query($str_sql); switch ($action) { case "insert":