当前位置: 首页>>代码示例>>PHP>>正文


PHP UploadFile::set方法代码示例

本文整理汇总了PHP中UploadFile::set方法的典型用法代码示例。如果您正苦于以下问题:PHP UploadFile::set方法的具体用法?PHP UploadFile::set怎么用?PHP UploadFile::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UploadFile的用法示例。


在下文中一共展示了UploadFile::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: store_editOp

 /**
  * 编辑店铺
  */
 public function store_editOp()
 {
     $upload = new UploadFile();
     /**
      * 上传店铺图片
      */
     if (!empty($_FILES['store_banner']['name'])) {
         $upload->set('default_dir', ATTACH_STORE);
         $upload->set('thumb_ext', '');
         $upload->set('file_name', '');
         $upload->set('ifremove', false);
         $result = $upload->upfile('store_banner');
         if ($result) {
             $_POST['store_banner'] = $upload->file_name;
         } else {
             showDialog($upload->error);
         }
     }
     //删除旧店铺图片
     if (!empty($_POST['store_banner']) && !empty($store_info['store_banner'])) {
         @unlink(BASE_UPLOAD_PATH . DS . ATTACH_STORE . DS . $this->store_info['store_banner']);
     }
     /**
      * 更新入库
      */
     $param = array('store_banner' => empty($_POST['store_banner']) ? $this->store_info['store_banner'] : $_POST['store_banner'], 'store_qq' => $_POST['store_qq'], 'store_ww' => $_POST['store_ww'], 'store_phone' => $_POST['store_phone'], 'store_zy' => $_POST['store_zy'], 'store_keywords' => $_POST['seo_keywords'], 'store_description' => $_POST['seo_description']);
     $result = Model('store')->editStore($param, array('store_id' => $this->store_info['store_id']));
     if (!$result) {
         output_error('编辑失败');
     }
     output_data('1');
 }
开发者ID:noikiy,项目名称:meizhan,代码行数:35,代码来源:seller_store.php

示例2: save_deliveryOp

 /**
  * 保存申请
  */
 public function save_deliveryOp()
 {
     if (!chksubmit()) {
         showDialog(L('wrong_argument'));
     }
     $insert = array();
     $insert['dlyp_name'] = $_POST['dname'];
     $insert['dlyp_passwd'] = md5($_POST['dpasswd']);
     $insert['dlyp_truename'] = $_POST['dtruename'];
     $insert['dlyp_mobile'] = $_POST['dmobile'];
     $insert['dlyp_telephony'] = $_POST['dtelephony'];
     $insert['dlyp_address_name'] = $_POST['daddressname'];
     $insert['dlyp_area_2'] = $_POST['area_id_2'];
     $insert['dlyp_area_3'] = $_POST['area_id'];
     $insert['dlyp_area_info'] = $_POST['area_info'];
     $insert['dlyp_address'] = $_POST['daddress'];
     $insert['dlyp_idcard'] = $_POST['didcard'];
     $insert['dlyp_addtime'] = TIMESTAMP;
     $insert['dlyp_state'] = 10;
     $upload = new UploadFile();
     $upload->set('default_dir', ATTACH_DELIVERY);
     $result = $upload->upfile('didcardimg');
     if (!$result) {
         showDialog($upload->error);
     }
     $insert['dlyp_idcard_image'] = $upload->file_name;
     $result = Model('delivery_point')->addDeliveryPoint($insert);
     if ($result) {
         showDialog('操作成功,等待管理员审核', 'index.php?act=login', 'succ');
     } else {
         showDialog(L('nc_common_op_fail'));
     }
 }
开发者ID:flying3615,项目名称:chuniang,代码行数:36,代码来源:joinin.php

示例3: upload_image

function upload_image($file)
{
    require_once '../class/upload.class.php';
    $db_img = new DB();
    if (!empty($file)) {
        $time = time();
        $year_month = date('Ym', $time);
        $day = date('d', $time);
        $uploaddir = SHOPPIC_DIR;
        $pic_array = array();
        foreach ($file as $k => $v) {
            $upload = new UploadFile();
            $upload->set('default_dir', $uploaddir);
            $result = $upload->upfile($k);
            if ($result) {
                $sizeinfo = getimagesize($uploaddir . DS . $upload->file_name);
                $pic_array[] = array($upload->file_name, $v['name'], $v['size'], $sizeinfo[0]);
                unset($sizeinfo);
            }
            unset($upload);
        }
        return $pic_array;
    }
    return array();
}
开发者ID:caidongyun,项目名称:CS,代码行数:25,代码来源:shoplist.add.php

示例4: image_uploadOp

 /**
  * 上传图片
  */
 public function image_uploadOp()
 {
     // 判断图片数量是否超限
     $model_album = Model('album');
     $album_limit = $this->store_grade['sg_album_limit'];
     if ($album_limit > 0) {
         $album_count = $model_album->getCount(array('store_id' => $_SESSION['store_id']));
         if ($album_count >= $album_limit) {
             $error = L('store_goods_album_climit');
             if (strtoupper(CHARSET) == 'GBK') {
                 $error = Language::getUTF8($error);
             }
             exit(json_encode(array('error' => $error)));
         }
     }
     $class_info = $model_album->getOne(array('store_id' => $_SESSION['store_id'], 'is_default' => 1), 'album_class');
     // 上传图片
     $upload = new UploadFile();
     $upload->set('default_dir', ATTACH_GOODS . DS . $_SESSION['store_id'] . DS . $upload->getSysSetPath());
     $upload->set('max_size', C('image_max_filesize'));
     $upload->set('thumb_width', GOODS_IMAGES_WIDTH);
     $upload->set('thumb_height', GOODS_IMAGES_HEIGHT);
     $upload->set('thumb_ext', GOODS_IMAGES_EXT);
     $upload->set('fprefix', $_SESSION['store_id']);
     $upload->set('allow_type', array('gif', 'jpg', 'jpeg', 'png'));
     $result = $upload->upfile($_POST['id']);
     if (!$result) {
         if (strtoupper(CHARSET) == 'GBK') {
             $upload->error = Language::getUTF8($upload->error);
         }
         $output = array();
         $output['error'] = $upload->error;
         $output = json_encode($output);
         exit($output);
     }
     $img_path = $upload->getSysSetPath() . $upload->file_name;
     $thumb_page = $upload->getSysSetPath() . $upload->thumb_image;
     // 取得图像大小
     list($width, $height, $type, $attr) = getimagesize(UPLOAD_SITE_URL . '/' . ATTACH_GOODS . '/' . $_SESSION['store_id'] . DS . $img_path);
     // 存入相册
     $image = explode('.', $_FILES[$_POST['id']]["name"]);
     $insert_array = array();
     $insert_array['apic_name'] = $image['0'];
     $insert_array['apic_tag'] = '';
     $insert_array['aclass_id'] = $class_info['aclass_id'];
     $insert_array['apic_cover'] = $img_path;
     $insert_array['apic_size'] = intval($_FILES[$_POST['id']]['size']);
     $insert_array['apic_spec'] = $width . 'x' . $height;
     $insert_array['upload_time'] = TIMESTAMP;
     $insert_array['store_id'] = $_SESSION['store_id'];
     $model_album->addPic($insert_array);
     $data = array();
     $data['image'] = cthumb($img_path, 240, $_SESSION['store_id']);
     // 整理为json格式
     $output = json_encode($data);
     echo $output;
     exit;
 }
开发者ID:mengtaolin,项目名称:shopping,代码行数:61,代码来源:store_sns.php

示例5: mb_home_editOp

 /**
  * 编辑
  */
 public function mb_home_editOp()
 {
     $model = Model('mb_home');
     if ($_POST['form_submit'] == 'ok') {
         //验证
         $obj_validate = new Validate();
         $obj_validate->validateparam = array(array("input" => $_POST["h_title"], "require" => "true", "message" => L('home_add_null')), array("input" => $_POST["h_desc"], "require" => "true", "message" => L('home_add_null')), array("input" => $_POST["h_keyword"], "require" => "true", "message" => L('home_add_null')), array("input" => $_POST["h_sort"], "require" => "true", 'validator' => 'Number', "message" => L('home_add_sort_int')));
         $error = $obj_validate->validate();
         if ($error != '') {
             showMessage($error);
         } else {
             $home_array = $model->getMbHomeInfoByID(intval($_POST['h_id']));
             //上传图片
             if ($_FILES['h_img']['name'] != '') {
                 $upload = new UploadFile();
                 $upload->set('default_dir', ATTACH_MOBILE . '/home');
                 $result = $upload->upfile('h_img');
                 if ($result) {
                     $_POST['h_img'] = $upload->file_name;
                 } else {
                     showMessage($upload->error);
                 }
             }
             $update_array = array();
             $update_array['h_title'] = trim($_POST['h_title']);
             $update_array['h_desc'] = trim($_POST['h_desc']);
             $update_array['h_keyword'] = trim($_POST['h_keyword']);
             if (!empty($_POST['h_multi_keyword'])) {
                 $update_array['h_multi_keyword'] = $_POST['h_multi_keyword'];
             }
             if ($_POST['h_img']) {
                 $update_array['h_img'] = $_POST['h_img'];
             }
             $update_array['h_sort'] = trim($_POST['h_sort']);
             $condition = array();
             $condition['h_id'] = intval($_POST['h_id']);
             $result = $model->editMbHome($update_array, $condition);
             if ($result) {
                 //除图片
                 if (!empty($_POST['h_img']) && !empty($home_array['h_img'])) {
                     @unlink(BASE_ROOT_PATH . DS . DIR_UPLOAD . DS . ATTACH_MOBILE . '/home' . DS . $home_array['h_img']);
                 }
                 showMessage(L('home_edit_succ'), 'index.php?act=mb_home&op=mb_home_list');
             } else {
                 showMessage(L('home_edit_fail'));
             }
         }
     }
     $home_array = $model->getMbHomeInfoByID(intval($_GET['h_id']));
     if (empty($home_array)) {
         showMessage(L('wrong_argument'));
     }
     Tpl::output('home_array', $home_array);
     Tpl::showpage('mb_home.edit');
 }
开发者ID:flying3615,项目名称:chuniang,代码行数:58,代码来源:mb_home.php

示例6: indexOp

	/**
	 * 店铺打印设置
	 */
	public function indexOp(){
		$model = Model();
		$store_info = $model->table('store')->where(array('store_id'=>$_SESSION['store_id']))->find();
		if(empty($store_info)){
			showDialog(Language::get('store_storeinfo_error'),'index.php?act=store_printsetup','error');
		}
		if(chksubmit()){
			$obj_validate = new Validate();
			$obj_validate->validateparam = array(
				array("input"=>$_POST['store_printdesc'], "require"=>"true","validator"=>"Length","min"=>1,"max"=>200,"message"=>Language::get('store_printsetup_desc_error'))
			);
			$error = $obj_validate->validate();
			if ($error != ''){
				showDialog($error);
			}
			$update_arr = array();
			//上传认证文件
			if($_FILES['store_stamp']['name'] != '') {
				$upload = new UploadFile();
				$upload->set('default_dir',ATTACH_STORE);
				if($_FILES['store_stamp']['name'] != '') {
					$result = $upload->upfile('store_stamp');
					if ($result){
						$update_arr['store_stamp'] = $upload->file_name;
						//删除旧认证图片
						if (!empty($store_info['store_stamp'])){
							@unlink(BASE_UPLOAD_PATH.DS.ATTACH_STORE.DS.$store_info['store_stamp']);
						}
					}
				}
			}
			$update_arr['store_printdesc'] = $_POST['store_printdesc'];
			$rs = $model->table('store')->where(array('store_id'=>$_SESSION['store_id']))->update($update_arr);
			if ($rs){
				showDialog(Language::get('nc_common_save_succ'),'index.php?act=store_printsetup','succ');
			}else {
				showDialog(Language::get('nc_common_save_fail'),'index.php?act=store_printsetup','error');
			}
		}else{
			Tpl::output('store_info',$store_info);
			self::profile_menu('store_printsetup');
			Tpl::showpage('store_printsetup');
		}
	}
开发者ID:noikiy,项目名称:ejia,代码行数:47,代码来源:store_printsetup.php

示例7: cms_manage_saveOp

 /**
  * cms设置保存
  */
 public function cms_manage_saveOp()
 {
     $model_setting = Model('setting');
     $update_array = array();
     $update_array['cms_isuse'] = intval($_POST['cms_isuse']);
     if (!empty($_FILES['cms_logo']['name'])) {
         $upload = new UploadFile();
         $upload->set('default_dir', ATTACH_CMS);
         $result = $upload->upfile('cms_logo');
         if (!$result) {
             showMessage($upload->error);
         }
         $update_array['cms_logo'] = $upload->file_name;
         $old_image = BASE_UPLOAD_PATH . DS . ATTACH_CMS . DS . C('microshop_logo');
         if (is_file($old_image)) {
             unlink($old_image);
         }
     }
     $update_array['cms_submit_verify_flag'] = intval($_POST['cms_submit_verify_flag']);
     $update_array['cms_comment_flag'] = intval($_POST['cms_comment_flag']);
     $update_array['cms_attitude_flag'] = intval($_POST['cms_attitude_flag']);
     $update_array['taobao_api_isuse'] = intval($_POST['taobao_api_isuse']);
     $update_array['taobao_app_key'] = $_POST['taobao_app_key'];
     $update_array['taobao_secret_key'] = $_POST['taobao_secret_key'];
     $update_array['cms_seo_title'] = $_POST['cms_seo_title'];
     $update_array['cms_seo_keywords'] = $_POST['cms_seo_keywords'];
     $update_array['cms_seo_description'] = $_POST['cms_seo_description'];
     $result = $model_setting->updateSetting($update_array);
     if ($result === true) {
         $this->log(Language::get('cms_log_manage_save'), 0);
         showMessage(Language::get('nc_common_save_succ'));
     } else {
         $this->log(Language::get('cms_log_manage_save'), 0);
         showMessage(Language::get('nc_common_save_fail'));
     }
 }
开发者ID:flying3615,项目名称:chuniang,代码行数:39,代码来源:cms_manage.php

示例8: pic_uploadOp

 /**
  * 图片上传
  *
  */
 public function pic_uploadOp()
 {
     if (chksubmit()) {
         //上传图片
         $upload = new UploadFile();
         $upload->set('thumb_width', 500);
         $upload->set('thumb_height', 499);
         $upload->set('thumb_ext', '_small');
         $upload->set('max_size', C('image_max_filesize') ? C('image_max_filesize') : 1024);
         $upload->set('ifremove', true);
         $upload->set('default_dir', $_GET['uploadpath']);
         if (!empty($_FILES['c_img']['tmp_name'])) {
             $result = $upload->upfile('c_img');
             if ($result) {
                 exit(json_encode(array('status' => 1, 'url' => UPLOAD_SITE_URL . '/' . $_GET['uploadpath'] . '/' . $upload->thumb_image)));
             } else {
                 exit(json_encode(array('status' => 0, 'msg' => $upload->error)));
             }
         }
     }
 }
开发者ID:dotku,项目名称:shopnc_cnnewyork,代码行数:25,代码来源:cut.php

示例9: uploadOp

 public function uploadOp()
 {
     if (!chksubmit()) {
         redirect('index.php?act=home&op=avatar');
     }
     import('function.thumb');
     Language::read('member_home_member,cut');
     $lang = Language::getLangContent();
     $member_id = $_SESSION['member_id'];
     //上传图片
     $upload = new UploadFile();
     $upload->set('thumb_width', 500);
     $upload->set('thumb_height', 499);
     $ext = strtolower(pathinfo($_FILES['pic']['name'], PATHINFO_EXTENSION));
     $upload->set('file_name', "avatar_{$member_id}.{$ext}");
     $upload->set('thumb_ext', '_new');
     $upload->set('ifremove', true);
     $upload->set('default_dir', ATTACH_AVATAR);
     if (!empty($_FILES['pic']['tmp_name'])) {
         $result = $upload->upfile('pic');
         if (!$result) {
             showMessage($upload->error, '', 'html', 'error');
         }
     } else {
         showMessage('upload failed', '', 'html', 'error');
     }
     self::profile_menu('member', 'avatar');
     Tpl::output('menu_sign', 'profile');
     Tpl::output('menu_sign_url', 'index.php?act=member&op=home');
     Tpl::output('menu_sign1', 'avatar');
     Tpl::output('newfile', $upload->thumb_image);
     Tpl::output('height', get_height(BASE_UPLOAD_PATH . '/' . ATTACH_AVATAR . '/' . $upload->thumb_image));
     Tpl::output('width', get_width(BASE_UPLOAD_PATH . '/' . ATTACH_AVATAR . '/' . $upload->thumb_image));
     Tpl::setLayout('member_pub_layout');
     Tpl::showpage('member_profile.avatar');
 }
开发者ID:noikiy,项目名称:shopnc-minion,代码行数:36,代码来源:home.php

示例10: image_uploadOp

 /**
  * 上传图片
  */
 public function image_uploadOp()
 {
     $lang = Language::getLangContent();
     if ($_GET['upload_type'] == 'uploadedfile') {
         if ($_POST['file_id'] != '') {
             $model_store_goods = Model('flea');
             $drop_stata = $model_store_goods->dropImageGoods(array('upload_id' => intval($_POST['file_id'])));
         }
         /**
          * 实例化json模型
          */
         /**
          * 上传图片
          */
         $upload = new UploadFile();
         $upload_dir = ATTACH_MALBUM . DS . $_SESSION['member_id'] . DS;
         $upload->set('default_dir', $upload_dir . $upload->getSysSetPath());
         $thumb_width = '240,1024';
         $thumb_height = '2048,1024';
         $upload->set('max_size', C('image_max_filesize'));
         $upload->set('thumb_width', $thumb_width);
         $upload->set('thumb_height', $thumb_height);
         $upload->set('fprefix', $_SESSION['member_id']);
         $upload->set('thumb_ext', '_240,_1024');
         $result = $upload->upfile('file');
         if ($result) {
             $_POST['pic'] = $upload->getSysSetPath() . $upload->file_name;
             $_POST['pic_thumb'] = $upload->getSysSetPath() . $upload->thumb_image;
         } else {
             //				echo json_encode(array('state'=>'false','message'=>$lang['iswfupload_upload_pic_fail']));
             echo "<script type='text/javascript'>alert('" . $upload->error . "');history.back();</script>";
             exit;
         }
         $img_path = $_POST['pic'];
         /**
          * 取得图像大小
          */
         list($width, $height, $type, $attr) = getimagesize(BASE_UPLOAD_PATH . DS . ATTACH_MALBUM . DS . $_SESSION['member_id'] . DS . $img_path);
         /**
          * 图片数据入库
          */
         $model_upload = Model('flea_upload');
         $insert_array = array();
         $image_type = array('goods_image' => 12, 'desc_image' => 13);
         //debug
         $insert_array['file_name'] = $_POST['pic'];
         $insert_array['file_thumb'] = $_POST['pic_thumb'];
         $insert_array['file_size'] = intval($_FILES['file']['size']);
         $insert_array['upload_time'] = time();
         $insert_array['item_id'] = intval($_POST['item_id']);
         $insert_array['store_id'] = $_SESSION['member_id'];
         $insert_array['upload_type'] = $image_type['goods_image'];
         $result2 = $model_upload->add($insert_array);
         $data = array();
         $data['file_id'] = $result2;
         $data['file_name'] = $_POST['pic_thumb'];
         $data['file_path'] = $_POST['pic_thumb'];
         $data['instance'] = 'goods_image';
         $data['id'] = $_POST['id'];
         /**
          * 整理为json格式
          */
         $output = json_encode($data);
         echo "<script type='text/javascript'>window.parent.add_uploadedfile('" . $output . "');</script>";
     }
     Tpl::showpage('flea_upload_image', 'null_layout');
 }
开发者ID:uwitec,项目名称:xbshop,代码行数:70,代码来源:member_flea.php

示例11: adv_editOp

 /**
  *
  * 修改广告
  */
 public function adv_editOp()
 {
     if ($_POST['form_submit'] != 'ok') {
         $adv = Model('adv');
         $condition['adv_id'] = intval($_GET['adv_id']);
         $adv_list = $adv->getList($condition);
         $ap_info = $adv->getApList();
         Tpl::output('ref_url', getReferer());
         Tpl::output('adv_list', $adv_list);
         Tpl::output('ap_info', $ap_info);
         Tpl::showpage('adv.edit');
     } else {
         $lang = Language::getLangContent();
         $adv = Model('adv');
         $upload = new UploadFile();
         /**
          * 验证
          */
         $obj_validate = new Validate();
         $obj_validate->validateparam = array(array("input" => $_POST["adv_name"], "require" => "true", "message" => $lang['ap_can_not_null']), array("input" => $_POST["adv_start_date"], "require" => "true", "message" => $lang['must_select_start_time']), array("input" => $_POST["adv_end_date"], "require" => "true", "message" => $lang['must_select_end_time']));
         $error = $obj_validate->validate();
         if ($error != '') {
             showMessage($error);
         } else {
             $param['adv_id'] = intval($_GET['adv_id']);
             $param['adv_title'] = trim($_POST['adv_name']);
             $param['adv_start_date'] = $this->getunixtime(trim($_POST['adv_start_date']));
             $param['adv_end_date'] = $this->getunixtime(trim($_POST['adv_end_date']));
             /**
              * 建立图片广告信息的入库数组
              */
             if ($_POST['mark'] == '0') {
                 if ($_FILES['adv_pic']['name'] != '') {
                     $upload->set('default_dir', ATTACH_ADV);
                     $result = $upload->upfile('adv_pic');
                     if (!$result) {
                         showMessage($upload->error, '', '', 'error');
                     }
                     $ac = array('adv_pic' => $upload->file_name, 'adv_pic_url' => trim($_POST['adv_pic_url']));
                     $ac = serialize($ac);
                     $param['adv_content'] = $ac;
                 } else {
                     $ac = array('adv_pic' => trim($_POST['pic_ori']), 'adv_pic_url' => trim($_POST['adv_pic_url']));
                     $ac = serialize($ac);
                     $param['adv_content'] = $ac;
                 }
             }
             /**
              * 建立文字广告信息的入库数组
              */
             if ($_POST['mark'] == '1') {
                 //判断页面编码确定汉字所占字节数
                 switch (CHARSET) {
                     case 'UTF-8':
                         $charrate = 3;
                         break;
                     case 'GBK':
                         $charrate = 2;
                         break;
                 }
                 if (strlen($_POST['adv_word']) > $_POST['adv_word_len'] * $charrate) {
                     $error = $lang['wordadv_toolong'];
                     showMessage($error);
                     die;
                 }
                 $ac = array('adv_word' => trim($_POST['adv_word']), 'adv_word_url' => trim($_POST['adv_word_url']));
                 $ac = serialize($ac);
                 $param['adv_content'] = $ac;
             }
             /**
              * 建立Flash广告信息的入库数组
              */
             if ($_POST['mark'] == '3') {
                 if ($_FILES['flash_swf']['name'] != '') {
                     $upload->set('default_dir', ATTACH_ADV);
                     $result = $upload->upfile('flash_swf');
                     $ac = array('flash_swf' => $upload->file_name, 'flash_url' => trim($_POST['flash_url']));
                     $ac = serialize($ac);
                     $param['adv_content'] = $ac;
                 } else {
                     $ac = array('flash_swf' => trim($_POST['flash_ori']), 'flash_url' => trim($_POST['flash_url']));
                     $ac = serialize($ac);
                     $param['adv_content'] = $ac;
                 }
             }
             $result = $adv->update($param);
             if ($result) {
                 $url = array(array('url' => trim($_POST['ref_url']), 'msg' => $lang['goback_ap_manage']));
                 $this->log(L('adv_change_succ') . '[' . $_POST["ap_name"] . ']', null);
                 showMessage($lang['adv_change_succ'], $url);
             } else {
                 showMessage($lang['adv_change_fail'], $url);
             }
         }
     }
 }
开发者ID:dotku,项目名称:shopnc_cnnewyork,代码行数:100,代码来源:adv.php

示例12: article_image_uploadOp

 /**
  * 文章图片上传
  */
 public function article_image_uploadOp()
 {
     $data = array();
     $data['status'] = 'success';
     if (!empty($this->publisher_name)) {
         if (!empty($_FILES['article_image_upload']['name'])) {
             $upload = new UploadFile();
             $upload->set('default_dir', ATTACH_CMS . DS . 'article' . DS . $this->attachment_path);
             $upload->set('thumb_width', '1024,240');
             $upload->set('thumb_height', '50000,5000');
             $upload->set('thumb_ext', '_max,_list');
             $result = $upload->upfile('article_image_upload');
             if (!$result) {
                 $data['status'] = 'fail';
                 $data['error'] = '图片上传失败';
             }
             $data['file_name'] = $upload->file_name;
             $data['origin_file_name'] = $_FILES['article_image_upload']['name'];
             $data['file_url'] = getCMSArticleImageUrl($this->attachment_path, $upload->file_name, 'max');
             $data['file_path'] = $this->attachment_path;
         }
     } else {
         $data['status'] = 'fail';
         $data['error'] = Language::get('no_login');
     }
     self::echo_json($data);
 }
开发者ID:noikiy,项目名称:cunkou,代码行数:30,代码来源:publish.php

示例13: reopen_uploadOp

 public function reopen_uploadOp()
 {
     if (!chksubmit()) {
         exit;
     }
     $upload = new UploadFile();
     $uploaddir = ATTACH_PATH . DS . 'store_joinin' . DS;
     $upload->set('default_dir', $uploaddir);
     $upload->set('allow_type', array('jpg', 'jpeg', 'gif', 'png'));
     if (!empty($_FILES['re_pay_cert']['tmp_name'])) {
         $result = $upload->upfile('re_pay_cert');
         if ($result) {
             $pic_name = $upload->file_name;
         }
     }
     $data = array();
     $data['re_pay_cert'] = $pic_name;
     $data['re_pay_cert_explain'] = $_POST['re_pay_cert_explain'];
     $data['re_state'] = 1;
     $model_store_reopen = Model('store_reopen');
     $update = $model_store_reopen->editStoreReopen($data, array('re_id' => $_POST['re_id'], 're_state' => 0));
     if ($update) {
         showDialog('上传成功,请等待系统审核', 'reload', 'succ');
     } else {
         showDialog(Language::get('nc_common_del_fail'));
     }
 }
开发者ID:xuxuecheng,项目名称:shopnc,代码行数:27,代码来源:store_info.php

示例14: image_uploadOp

 /**
  * 附件批量上传 话题
  */
 public function image_uploadOp()
 {
     $data['msg'] = 'error';
     $data['origin_file_name'] = $_FILES['test_file']['name'];
     // 验证已上传附件数量  最大10个
     $where = array();
     $where['member_id'] = $_SESSION['member_id'];
     if ($_GET['type'] == 'reply') {
         $where['affix_type'] = 2;
         $where['reply_id'] = 0;
     } else {
         $where['affix_type'] = 1;
         $where['theme_id'] = 0;
     }
     $count = Model()->table('circle_affix')->where($where)->count();
     if ($count < 10) {
         $partpath = themePartPath($_SESSION['member_id']);
         $upload = new UploadFile();
         $upload->set('default_dir', ATTACH_CIRCLE . '/theme/' . $partpath);
         $upload->set('thumb_width', 1024);
         $upload->set('thumb_height', 160);
         $upload->set('thumb_ext', '_160x160');
         $result = $upload->upfile('test_file');
         // 暂时的名字
         if ($result) {
             $insert = array();
             $insert['affix_filename'] = $partpath . '/' . $upload->file_name;
             $insert['affix_filethumb'] = $partpath . '/' . $upload->thumb_image;
             $insert['affix_filesize'] = intval($_FILES['test_file']['size']);
             $insert['affix_addtime'] = time();
             $insert['affix_type'] = $_GET['type'] == 'reply' ? 2 : 1;
             $insert['member_id'] = $_SESSION['member_id'];
             $insert['theme_id'] = $this->t_id;
             $insert['reply_id'] = 0;
             $insert['circle_id'] = $this->c_id;
             $id = Model()->table('circle_affix')->insert($insert);
             if ($id) {
                 $data['msg'] = 'success';
                 $data['file_id'] = $id;
                 $data['file_name'] = $upload->file_name;
                 $data['file_url'] = themeImageUrl($partpath . '/' . $upload->thumb_image);
                 $data['file_insert'] = themeImageUrl($partpath . '/' . $upload->file_name);
             }
         }
     }
     echo json_encode($data);
     exit;
 }
开发者ID:mengtaolin,项目名称:shopping,代码行数:51,代码来源:theme.php

示例15: image_uploadOp

 /**
  * ajax图片上传
  */
 public function image_uploadOp()
 {
     $ap_id = intval($_POST['apid']);
     /**
      * 相册
      */
     $model = Model();
     $default_class = $model->table('sns_albumclass')->where(array('member_id' => $_SESSION['member_id'], 'is_default' => 1))->find();
     if (empty($default_class)) {
         // 验证时候存在买家秀相册,不存在添加。
         $default_class = array();
         $default_class['ac_name'] = Language::get('sns_buyershow');
         $default_class['member_id'] = $this->master_id;
         $default_class['ac_des'] = Language::get('sns_buyershow_album_des');
         $default_class['ac_sort'] = '255';
         $default_class['is_default'] = 1;
         $default_class['upload_time'] = time();
         $default_class['ac_id'] = $model->table('sns_albumclass')->insert($default_class);
     }
     // 验证图片数量
     $count = $model->table('sns_albumpic')->where(array('member_id' => $_SESSION['member_id']))->count();
     if (C('malbum_max_sum') != 0 && $count >= C('malbum_max_sum')) {
         $output = array();
         $output['error'] = Language::get('sns_upload_img_max_num_error');
         $output = json_encode($output);
         echo $output;
         die;
     }
     /**
      * 上传图片
      */
     $upload = new UploadFile();
     if ($ap_id > 0) {
         $pic_info = $model->table('sns_albumpic')->find($ap_id);
         if (!empty($pic_info)) {
             $upload->set('file_name', $pic_info['ap_cover']);
         }
         // 原图存在设置图片名称为原图名称
     }
     $upload_dir = ATTACH_MALBUM . DS . $_SESSION['member_id'] . DS;
     $upload->set('default_dir', $upload_dir . $upload->getSysSetPath());
     $thumb_width = '240,1024';
     $thumb_height = '2048,1024';
     $upload->set('max_size', C('image_max_filesize'));
     $upload->set('thumb_width', $thumb_width);
     $upload->set('thumb_height', $thumb_height);
     $upload->set('fprefix', $_SESSION['member_id']);
     $upload->set('thumb_ext', '_240,_1024');
     $result = $upload->upfile(trim($_POST['id']));
     if (!$result) {
         if (strtoupper(CHARSET) == 'GBK') {
             $upload->error = Language::getUTF8($upload->error);
         }
         $output = array();
         $output['error'] = $upload->error;
         $output = json_encode($output);
         echo $output;
         die;
     }
     if ($ap_id <= 0) {
         // 如果原图存在,则不需要在插入数据库
         $img_path = $upload->getSysSetPath() . $upload->file_name;
         list($width, $height, $type, $attr) = getimagesize(BASE_UPLOAD_PATH . DS . ATTACH_MALBUM . DS . $_SESSION['member_id'] . DS . $img_path);
         $image = explode('.', $_FILES[trim($_POST['id'])]["name"]);
         if (strtoupper(CHARSET) == 'GBK') {
             $image['0'] = Language::getGBK($image['0']);
         }
         $insert = array();
         $insert['ap_name'] = $image['0'];
         $insert['ac_id'] = $default_class['ac_id'];
         $insert['ap_cover'] = $img_path;
         $insert['ap_size'] = intval($_FILES[trim($_POST['id'])]['size']);
         $insert['ap_spec'] = $width . 'x' . $height;
         $insert['upload_time'] = time();
         $insert['member_id'] = $_SESSION['member_id'];
         $insert['ap_type'] = 1;
         $insert['item_id'] = intval($_POST['sid']);
         $result = $model->table('sns_albumpic')->insert($insert);
     }
     $data = array();
     $data['file_name'] = $ap_id > 0 ? $pic_info['ap_cover'] : $upload->getSysSetPath() . $upload->thumb_image;
     $data['file_id'] = $ap_id > 0 ? $pic_info['ap_id'] : $result;
     /**
      * 整理为json格式
      */
     $output = json_encode($data);
     echo $output;
     die;
 }
开发者ID:mengtaolin,项目名称:shopping,代码行数:92,代码来源:member_snshome.php


注:本文中的UploadFile::set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。