public function fileupload_f() { $info = upLoad(); $info = $info['IDNumberImg2']; $url = $info['savepath']; if ($url) { $this->ajaxReturn(array(0 => array('status' => 1, 'message' => '上传成功', 'url' => $url, 'showurl' => $info['url']))); } else { $this->ajaxReturn(array(0 => array('status' => 0, 'message' => '上传失败'))); } }
//ทำการลบสินค้าจากฐานข้อมูล if (isset($_POST['submit_del'])) { $sDelSql = buildSQLDelete('goods', 'ID_goods', "{$_POST['ID_goods']}"); if ($mysqli->query($sDelSql)) { echo ""; } if ($per_page == 1 and $page != 1) { $pre_page = $page - 1; echo '<form name="page" method="post" action="' . $_SERVER['PHP_SELF'] . '">', '<input type="hidden" name="page" value="' . $pre_page . '">', '<script language="JavaScript">document.page.submit();</script></form>'; } echo '<script type="text/javascript">window.setTimeout(window.location="' . $_SERVER['PHP_SELF'] . '",0);</script>'; } //ทำการแก้ไขตารางสินค้า if (isset($_POST['submit_edit'])) { if ($_FILES['new_Pic_goods']['name'] != '') { upLoad('new_Pic_goods'); $axUpdate = array('Name_goods' => "{$_POST['new_Name_goods']}", 'Date_goods' => "{$_POST['new_Date_goods']}", 'Type_goods' => "{$_POST['new_Type_goods']}", 'Price_goods' => "{$_POST['new_Price_goods']}", 'Stock_goods' => "{$_POST['new_Stock_goods']}", 'Discount_goods' => "{$_POST['new_Discount_goods']}", 'DiscountDateStart_goods' => "{$_POST['new_DiscountDateStart_goods']}", 'DiscountTimeStart_goods' => "{$_POST['new_DiscountTimeStart_goods']}", 'DiscountDateEnd_goods' => "{$_POST['new_DiscountDateEnd_goods']}", 'DiscountTimeEnd_goods' => "{$_POST['new_DiscountTimeEnd_goods']}", 'Pic_goods' => "./images/" . basename($_FILES["new_Pic_goods"]["name"]), 'Add_goods' => "{$_POST['new_Add_goods']}"); } else { $axUpdate = array('Name_goods' => "{$_POST['new_Name_goods']}", 'Date_goods' => "{$_POST['new_Date_goods']}", 'Type_goods' => "{$_POST['new_Type_goods']}", 'Price_goods' => "{$_POST['new_Price_goods']}", 'Stock_goods' => "{$_POST['new_Stock_goods']}", 'Discount_goods' => "{$_POST['new_Discount_goods']}", 'DiscountDateStart_goods' => "{$_POST['new_DiscountDateStart_goods']}", 'DiscountTimeStart_goods' => "{$_POST['new_DiscountTimeStart_goods']}", 'DiscountDateEnd_goods' => "{$_POST['new_DiscountDateEnd_goods']}", 'DiscountTimeEnd_goods' => "{$_POST['new_DiscountTimeEnd_goods']}", 'Pic_goods' => "{$_POST['old_Pic_goods']}", 'Add_goods' => "{$_POST['new_Add_goods']}"); } $sEditSql = buildSQLUpdate('goods', 'ID_goods', "{$_POST['ID_goods']}", $axUpdate); if ($mysqli->query($sEditSql)) { echo ""; } } $maxID = 1; if ($result = $mysqli->query('SELECT * FROM `' . DB_NAME . '`.`goods`')) { for ($igoods = 0; $igoods < $result->num_rows; $igoods++) { $row = $result->fetch_assoc(); if ($maxID < $row['ID_goods']) { $maxID = $row['ID_goods'];
public function ImgUpload() { $info = upLoad(); //var_dump($info['imgFile']); $info = $info['imgFile']; if ($info['url']) { $arr = array("error" => 0, "url" => $info['url'], "file" => $info['savepath'], "outid" => $info['name'], "original" => $info['name'], "type" => $info['type'], "size" => $info['size']); echo json_encode($arr); } else { $this->ajaxReturn(array('error' => 1, 'message' => '上传文件失败!!!')); } }
/** *单张修改图片上传 */ public function fileuploadup() { $info = upLoad(); $info = $info['avatarup']; $url = $info['url']; $inurl = $info['savepath']; if ($url) { $this->ajaxReturn(array(0 => array('status' => 1, 'message' => '上传成功', 'url' => $url, 'inurl' => $inurl))); } else { $this->ajaxReturn(array(0 => array('status' => 0, 'message' => '上传失败'))); } }
/** * 图片上传 */ public function uploadImgLogo() { $result = array(); $result['success'] = false; $success_num = 0; $msg = ''; $source_pic = $_FILES["__source"]; //<------------------------------------------------------------------------处理原始图片结束 // 处理头像图片开始------------------------------------------------------------------------> //头像图片(file 域的名称:__avatar1,2,3...)。 $avatars = array("__avatar1"); $avatar = $_FILES['__avatar1']; if ($avatar['error'] > 0) { $msg = $avatar['error']; } else { $savePath = $avatar['tmp_name'] . ".jpg"; move_uploaded_file($avatar["tmp_name"], $savePath); $_FILES['__avatar1']['tmp_name'] = $savePath; $info = upLoad(array('width' => 118, 'height' => 118)); $names = array_keys($_FILES); $name = array_shift($names); $shop_id = $_REQUEST['shop_id']; if ($name) { $info = $info[$name]; //保存到附件表中 //dump($info);exit(); $data['biz_id'] = $shop_id; $data['biz_type'] = '店铺'; //$data['upload_user_id'] = ''; //$data['upload_user_type'] = ; $data['file_name'] = $info['name']; $data['file_size'] = $info['size']; $data['file_type'] = $info['ext'] ? $info['ext'] : 'jpg'; $data['file_url'] = $info['savepath']; $data['create_time'] = date("Y-m-d H:i:s"); $attachmentModel = M('Attachment'); $attachmentModel->create($data); $attachment_id = $attachmentModel->add(); if ($attachment_id) { $update_id = M('attachment_relation')->data(array('attachement_id' => $attachment_id))->where(array('biz_id' => $shop_id, 'biz_type' => '1', 'pic_type' => '1'))->save(); if (!$update_id) { $this->addRelation($shop_id, $attachment_id, 1); } //logo图片关系表 1缩略图 } $result['code'] = 5; $result['url'] = $info['url']; $result['savePath'] = $info['savepath']; $result['attachement_id'] = $attachment_id; } $success_num++; } //<------------------------------------------------------------------------处理头像图片结束 //upload_url中传递的额外的参数,如果定义的method为get请换为$_GET $result['msg'] = $msg; if ($success_num > 0) { $result['success'] = true; } print json_encode($result); }
} else { if ($type == "saveSchedule") { //kylschema.php?type=saveSchedule&name="namnet"&temp="temperaturen" saveSchedule(); } else { if ($type == "getSchedule") { //kylschema.php?type=getSchedule&name="namnet" getSchedule(); } else { if ($type == "getList") { //kylschema.php?type=getList getList(); } else { if ($type == "upLoad") { //kylschema.php?type=upLoad&name="namnet"&temp="temperaturen" upLoad(); } else { if ($type = "delete") { //kylschema.php?type=delete&name="namnet" delete(); } } } } } } function checkName() { //Funktion som kollar om namnet finns i databsen. $name = $_REQUEST["name"]; if (preg_match("/[a-zA-ZåäöÅÄÖ0-9]+/", $name)) {
public function fileupload() { $info = upLoad(); $info = $info['toolsImg1']; $url = $info['url']; if ($url) { $this->ajaxReturn(array(0 => array('status' => 1, 'message' => '上传成功', 'url' => $url))); } else { $this->ajaxReturn(array(0 => array('status' => 0, 'message' => '上传失败'))); } }
public function fileupload() { /*$info = upLoad(); $info = $info['IDNumberImg1']; $url = $info['savepath']; if($url){ $this->ajaxReturn(array(0=>array('status'=>1,'message'=>'上传成功','url'=>$url,'showurl'=>$info['url']))); }else{ $this->ajaxReturn(array(0=>array('status'=>0,'message'=>'上传失败'))); }*/ $info = upLoad(array('width' => 120, 'height' => 120)); $names = array_keys($_FILES); $name = array_shift($names); if ($name) { $info = $info[$name]; //保存到附件表中 //$data['biz_id'] = $shop_id; $data['biz_type'] = '运营分类'; //$data['upload_user_id'] = ''; //$data['upload_user_type'] = ; $data['file_name'] = $info['name']; $data['file_size'] = $info['size']; $data['file_type'] = $info['ext']; $data['file_url'] = $info['savepath']; $data['create_time'] = date("Y-m-d H:i:s"); $attachmentModel = M('Attachment'); $attachmentModel->create($data); $attachment_id = $attachmentModel->add(); if ($attachment_id) { $this->ajaxReturn(array(0 => array('status' => 1, 'message' => '上传成功', 'savePath' => $info['savepath'], 'attachement_id' => $attachment_id))); } else { $this->ajaxReturn(array(0 => array('status' => 0, 'message' => '上传失败'))); } } }
public function sendmail() { $position = $_REQUEST['position']; if (empty($position)) { $this->error('职位名称不能为空!'); } if ($_FILES) { $info = upLoad(); } else { $this->error('请上传简历!'); } if ($info['resumeFile']['url']) { $content = "<a href='" . $info['resumeFile']['url'] . "'>" . $position . "</a>"; $mail = '*****@*****.**'; //$mail = '*****@*****.**'; $title = $position; if (SendMail($mail, $title, $content)) { $this->error('提交成功后回复内容,谢谢。HI,终于等到你啦!简历接收后,3个工作日内回复您,感谢您申请。'); } else { $this->error('发送失败'); } } else { $this->error('上传文件失败'); } }
public function firmware_n_add() { if (!I('type_id')) { $info = upLoad(); $app_version = M('app_version'); $map['download_url'] = $info['install']['savepath']; $map['version_size'] = $info['install']['size']; $map['version_id'] = $_REQUEST['accountName']; $map['version_desc'] = $_REQUEST['comment']; $map['md5'] = $_REQUEST['password']; $map['create_time'] = date('Y-m-d H:i:s', time()); $map['app_id'] = 6; $map['release_datetime'] = date('Y-m-d H:i:s', time()); $map['lastest_flag'] = 1; $result = $app_version->add($map); if ($result) { $map1['lastest_flag'] = 0; $map2['app_version_id'] = array('neq', $result); $map2['app_id'] = 6; $upda = $app_version->where($map2)->save($map1); $this->success('成功', 'firmware_n'); } else { $this->error('失败', 'firmware_n'); } } else { $map['app_version_id'] = $_REQUEST['type_id']; $where['version_id'] = $_REQUEST['accountName']; $where['version_desc'] = $_REQUEST['comment']; $result = M('app_version')->where($map)->save($where); if ($result) { $this->success('成功', 'firmware_n'); } else { $this->error('失败', 'firmware_n'); } } }