Beispiel #1
0
 public function saveupload()
 {
     $json = new Services_JSON();
     $uploadpath = 'upload/goods/';
     $filepath = '/upload/goods/';
     $upload = new upload($uploadpath, array('gif', 'jpg', 'jpge', 'png'));
     //upload
     $file = $upload->getfile();
     if ($upload->errno != 15 && $upload->errno != 0) {
         $msg = $json->encode(array('error' => 1, 'message' => $upload->errmsg()));
     } else {
         $msg = $json->encode(array('error' => 0, 'url' => $filepath . $file[0][saveName], 'trueurl' => $upload->returninfo['name']));
     }
     echo $msg;
     exit;
 }
Beispiel #2
0
 function goodsupload()
 {
     $link = IUrl::creatUrl('member/login');
     if ($this->member['uid'] == 0 && $this->admin['uid'] == 0) {
         $this->message('未登陆', $link);
     }
     $type = IReq::get('type');
     $goodsid = intval(IReq::get('goodsid'));
     $shopid = ICookie::get('adminshopid');
     if ($shopid < 0) {
         echo '无权限操作';
         exit;
     }
     if (is_array($_FILES) && isset($_FILES['imgFile'])) {
         $json = new Services_JSON();
         $uploadpath = 'upload/shop/';
         $filepath = '/upload/shop/';
         $upload = new upload($uploadpath, array('gif', 'jpg', 'jpge', 'doc', 'png'));
         //upload
         $file = $upload->getfile();
         if ($upload->errno != 15 && $upload->errno != 0) {
             echo "<script>parent.uploaderror('" . json_encode($upload->errmsg()) . "');</script>";
         } else {
             if ($goodsid > 0 && $shopid > 0) {
                 $data['img'] = $filepath . $file[0]['saveName'];
                 $this->mysql->update(Mysite::$app->config['tablepre'] . 'goods', $data, "id='" . $goodsid . "' and shopid='" . $shopid . "'");
             }
             echo "<script>parent.uploadsucess('" . $filepath . $file[0]['saveName'] . "');</script>";
         }
         exit;
     }
     $imgurl = '';
     if ($goodsid > 0 && $type == 'goods') {
         $temp = $this->mysql->select_one("select img from " . Mysite::$app->config['tablepre'] . "goods where id='" . $goodsid . "' and shopid='" . $shopid . "'");
         $imgurl = $temp['img'];
     }
     Mysite::$app->setdata(array('type' => $type, 'goodsid' => $goodsid, 'imgurl' => $imgurl));
 }
Beispiel #3
0
 /*文件上传处理程序*/
 $file = $_FILES['fileField'];
 $attachurl = '';
 if ($file['size'] > 0) {
     $fileArr['file'] = $file['tmp_name'];
     $fileArr['name'] = $file['name'];
     $fileArr['size'] = $file['size'];
     $fileArr['type'] = $file['type'];
     $file_name = 'f' . mt_rand(100, 999) . strtotime(date('Y-m-d H:i:s', time())) . strtolower(strrchr($file['name'], "."));
     $filetypes = explode(' ', $webdb[upfileType]);
     $savepath = "../upload_files/guestbook/";
     $maxsize = 0;
     $overwrite = 0;
     $upload = new upload($fileArr, $file_name, $savepath, $filetypes, $overwrite, $maxsize);
     if (!$upload->run()) {
         showerr($upload->errmsg());
     }
     $attachurl = "guestbook/" . $file_name;
 }
 $db->query("INSERT INTO `{$_pre}content` ( `ico` , `email` , `oicq` , `weburl` , `blogurl` , `uid` , `username` , `ip` , `content` , `yz` , `posttime` , `list`, `fid`, `mobphone`, `companyname`, `truename`, `phone`, `deadline`, `attach1`, `attach2`, `attach3`, `attachurl`, `ofid`, `aid` , `goods_num`, `goods_spe`, `goods_remark`)\n\tVALUES (\n\t'{$face}','{$postdb['email']}','{$postdb['oicq']}','{$postdb['weburl']}','{$postdb['blogurl']}','{$lfjuid}','{$postdb['username']}','{$onlineip}','{$postdb['content']}','{$yz}','{$timestamp}','{$timestamp}','{$fid}','{$postdb['mobphone']}','{$postdb['companyname']}','{$postdb['truename']}','{$postdb['phone']}','{$postdb['deadline']}','{$postdb['attach1']}','{$postdb['attach2']}','{$postdb['attach3']}','{$attachurl}','{$postdb['ofid']}','{$postdb['aid']}','{$postdb['goods_num']}','{$postdb['goods_spe']}','{$postdb['goods_remark']}')\n\t");
 /*发送邮件程序*/
 require_once 'phpmailer/class.phpmailer.php';
 $content .= "公司名称:" . $postdb[companyname] . "<br>联系人:" . $postdb[truename] . "<br>电子邮件:" . $postdb[email] . "<br>联系电话:" . $postdb[phone] . "<br>交货期:" . $postdb[deadline] . "<br>commodity code:" . $postdb[goods_sn] . "<br>name of commodity:" . $postdb[title] . "<br>number:" . $postdb[goods_num] . "<br>specification:" . $postdb[goods_spe] . "<br>remarks:" . $postdb[goods_remark] . "<br>询价中需要说明的要求1:" . $postdb[attach1] . "<br>询价中需要说明的要求2:" . $postdb[attach2] . "<br>询价中需要说明的要求3:" . $postdb[attach3];
 $content = iconv('GBK', 'UTF-8', $content);
 send_email($content);
 $rurl = "?fid={$fid}";
 if ($postdb[ofid]) {
     $rurl .= "&ofid={$ofid}";
 }
 if ($postdb[aid]) {
     $rurl .= "&aid={$aid}";