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


PHP AZLib::folderUpload方法代码示例

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


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

示例1: on_submit

 function on_submit()
 {
     if (!User::is_block()) {
         $file_name = strtolower($_FILES['avatar_url']['name']);
         $upload_path = AZLib::folderUpload(User::id(), 'avatar');
         $max_upload_file_size = 2 * 1024 * 1024;
         $file_ext = AZLib::getExtension(strtolower($file_name));
         $new_path = '';
         if ($file_name && in_array($file_ext, array('.jpg', '.jpeg', '.gif', '.png')) && filesize($_FILES['avatar_url']['tmp_name']) < $max_upload_file_size) {
             if (AZLib::ftp_check_dir($upload_path, true, IMAGE_SERVER_NO)) {
                 if (User::$current->data['avatar_url'] != '') {
                     @AZLib::ftp_image_delete_file(User::$current->data['avatar_url'], User::$current->data['img_server']);
                 }
                 $new_path = $upload_path . date("YmdHis", TIME_NOW) . '_' . substr(AZLib::make_safe_name(basename($file_name, $file_ext)), 0, 36) . $file_ext;
                 @AZLib::ftp_image_put_file($new_path, $_FILES['avatar_url']['tmp_name'], IMAGE_SERVER_NO);
             }
         }
         $phone_verify = User::$current->data['phone_verify'];
         $this->update_user($new_path, $phone_verify, IMAGE_SERVER_NO);
         //đang làm dở
         User::getUser(User::id(), true);
         echo '<script>document.location.href="' . WEB_ROOT . AZRewrite::formatUrl('?page=personal&cmd=edit_user&action=success_edit_user') . '"</script>';
     } else {
         $this->setFormError('', "Tài khoản của bạn hiện đang bị khóa, bạn không thể thực hiện chức năng này!");
     }
 }
开发者ID:duynhan07,项目名称:elink,代码行数:26,代码来源:EditUser.php

示例2: item_image_upload

 function item_image_upload()
 {
     //
     if ((User::have_permit(ADMIN_ITEM) || User::is_mod()) && (int) Url::get('user_id', 0) && (int) Url::get('user_id', 0) != User::id()) {
         $user_id = (int) Url::get('user_id', 0);
         $user_name = '';
         $user = User::getUser($user_id);
         if ($user) {
             $user_name = $user['user_name'];
         }
     } else {
         $user_id = User::id();
         $user_name = User::user_name();
     }
     $json['error'] = 'not_uploaded';
     $json['id'] = 0;
     $json['image_url'] = '';
     if (User::is_login()) {
         if (User::is_az_team() || User::level() > 0) {
             $upload_path = AZLib::folderUpload($user_id);
             if (AZLib::ftp_check_dir($upload_path, true, IMAGE_SERVER_NO)) {
                 //Check dir for upload
                 if (isset($_FILES['img_upload']) && !$_FILES['img_upload']['error'] && $_FILES['img_upload']['name']) {
                     list($imagewidth, $imageheight, $imageType) = getimagesize($_FILES['img_upload']['tmp_name']);
                     if ($imagewidth && $_FILES['img_upload']['size'] <= Item::MAX_UPLOAD_SIZE) {
                         /* if(($imagewidth > 479)||($imageheight > 359))
                            {
                            if($imagewidth > 479)//&& ($imagewidth < 1281) && ($imageheight < 1025))
                            {
                            if($imageheight > 359)
                            { */
                         $file_name = $_FILES['img_upload']['name'];
                         $sourceName = $_FILES['img_upload']['tmp_name'];
                         $file_ext = AZLib::getExtension($file_name);
                         if (in_array($file_ext, array('.jpg', '.jpeg', '.gif', '.png'))) {
                             $img_url = $upload_path . date("YmdHis", TIME_NOW) . '_' . substr(AZLib::make_safe_name(basename(strtolower($file_name), $file_ext)), 0, 36) . $file_ext;
                             /* $json['error'] = AZLib::ftp_image_put_file($img_url, $sourceName, IMAGE_SERVER_NO);
                                echo json_encode($json);
                                exit; */
                             if (AZLib::ftp_image_put_file($img_url, $sourceName, IMAGE_SERVER_NO)) {
                                 $image_id = DB::insert('item_image', array('des' => '', 'item_id' => 0, 'title' => '', 'position' => 0, 'img_server' => IMAGE_SERVER_NO, 'img_url' => $img_url, 'root_id' => 0, 'time' => TIME_NOW, 'user_id' => $user_id, 'user_name' => $user_name));
                                 if ($image_id) {
                                     $json['id'] = $image_id;
                                     $json['img_server'] = IMAGE_SERVER_NO;
                                     $json['image_url'] = $img_url;
                                     $json['error'] = 'success';
                                 }
                             }
                         } else {
                             $json['error'] = 'ext_invalid';
                             //Sai định dạng file
                         }
                         /* }
                            else
                            {
                            $json['error'] = 'height_not_allow';
                            }
                            }
                            else
                            {
                            $json['error'] = 'width_not_allow';
                            }
                            }
                            else
                            {
                            $json['error'] = 'width_n_height_not_allow';
                            } */
                     } else {
                         $json['error'] = 'over_max_size';
                         //Sai định dạng file hoặc upload dung lượng quá lớn
                     }
                 } elseif ($_POST['url'] && $_POST['url'] != 'Hoặc Url') {
                     $url = $_POST['url'];
                     $tem_cache_dir = DIR_CACHE . 'user_images/';
                     AZLib::CheckDir($tem_cache_dir);
                     $tem_cache_file = User::user_name() . md5($url) . '.gif';
                     $image_content = disguise_curl($url);
                     if ($image_content) {
                         if (@file_put_contents($tem_cache_dir . $tem_cache_file, $image_content)) {
                             if (getimagesize($tem_cache_dir . $tem_cache_file) && filesize($tem_cache_dir . $tem_cache_file) <= Item::MAX_UPLOAD_SIZE) {
                                 $sourceName = $tem_cache_dir . $tem_cache_file;
                                 $img_url = $upload_path . TIME_NOW . '_' . $tem_cache_file;
                                 //$json['error'] = AZLib::ftp_image_put_file($img_url, $sourceName, IMAGE_SERVER_NO);
                                 //echo json_encode($json);
                                 //exit;
                                 if (AZLib::ftp_image_put_file($img_url, $sourceName, IMAGE_SERVER_NO)) {
                                     $image_id = DB::insert('item_image', array('des' => '', 'item_id' => 0, 'title' => '', 'position' => 0, 'img_server' => IMAGE_SERVER_NO, 'img_url' => $img_url, 'root_id' => 0, 'time' => TIME_NOW, 'user_id' => $user_id, 'user_name' => $user_name));
                                     if ($image_id) {
                                         $json['id'] = $image_id;
                                         $json['img_server'] = IMAGE_SERVER_NO;
                                         $json['image_url'] = $img_url;
                                         $json['url_error'] = 'success';
                                     } else {
                                         $json['url_error'] = 'over_max_size';
                                     }
                                 } else {
                                     $json['url_error'] = 'not_uploaded';
                                 }
                             } else {
                                 $json['url_error'] = 'over_max_size';
//.........这里部分代码省略.........
开发者ID:duynhan07,项目名称:elink,代码行数:101,代码来源:ajax_upload.ajax.php

示例3: list

    $user = User::getUser($user_id);
    if ($user) {
        $user_name = $user['user_name'];
    }
    User::$current->data = $user;
    User::$current->groups = User::get_groups($user['gids']);
    $_SESSION['user_id'] = $user_id;
    $_SESSION['user_name'] = $user_name;
}
$arrRet['error'] = 'not_uploaded';
$arrRet['id'] = 0;
$arrRet['img_server'] = -1;
$arrRet['image_url'] = '';
if (User::is_login()) {
    if (User::have_permit(ADMIN_ITEM)) {
        $upload_path = AZLib::folderUpload();
        if (AZLib::ftp_check_dir($upload_path, true, IMAGE_SERVER_NO)) {
            //Check dir for upload
            if (isset($_FILES['Filedata']) && $_FILES['Filedata']['name']) {
                $file_name = $_FILES['Filedata']['name'];
                $sourceName = $_FILES['Filedata']['tmp_name'];
                $file_ext = AZLib::getExtension($file_name);
                if (in_array($file_ext, array('.jpg', '.jpeg', '.gif', '.png'))) {
                    if (!$_FILES['Filedata']['error']) {
                        list($imagewidth, $imageheight, $imageType) = getimagesize($_FILES['Filedata']['tmp_name']);
                        if ($imagewidth && $_FILES['Filedata']['size'] <= Item::MAX_UPLOAD_SIZE) {
                            $img_url = $upload_path . date("YmdHis", TIME_NOW) . '_' . substr(AZLib::make_safe_name(basename(strtolower($file_name), $file_ext)), 0, 36) . $file_ext;
                            if (AZLib::ftp_image_put_file($img_url, $sourceName, IMAGE_SERVER_NO)) {
                                $image_id = DB::insert('item_image', array('des' => '', 'item_id' => 0, 'title' => '', 'position' => 0, 'img_server' => IMAGE_SERVER_NO, 'img_url' => $img_url, 'root_id' => 0, 'time' => TIME_NOW, 'user_id' => User::id(), 'user_name' => User::user_name()));
                                if ($image_id) {
                                    $arrRet['id'] = $image_id;
开发者ID:duynhan07,项目名称:elink,代码行数:31,代码来源:swfupload.php

示例4: edit_user

 function edit_user()
 {
     $file_name = strtolower($_FILES['avatar_url']['name']);
     $upload_path = AZLib::folderUpload(User::id(), 'avatar');
     $max_upload_file_size = 2 * 1024 * 1024;
     $file_ext = AZLib::getExtension($file_name);
     $new_path = '';
     if ($file_name && in_array($file_ext, array('.jpg', '.jpeg', '.gif', '.png')) && filesize($_FILES['avatar_url']['tmp_name']) < $max_upload_file_size) {
         if (AZLib::ftp_check_dir($upload_path)) {
             $old_avatar_url = Url::get('old_avatar_url');
             if ($old_avatar_url != '') {
                 @AZLib::ftp_image_delete_file($old_avatar_url);
             }
             $new_path = $upload_path . date("YmdHis", TIME_NOW) . '_' . substr(AZLib::make_safe_name(basename($file_name, $file_ext)), 0, 36) . $file_ext;
             @AZLib::ftp_image_put_file($new_path, $_FILES['avatar_url']['tmp_name']);
         }
     }
     $show_email = Url::get('show_email');
     $email_alert = Url::get('email_alert');
     $new_blast = Url::get('blast');
     if (AZLib::checkBadWord($new_blast)) {
         $new_blast = '';
     }
     $new_sign = Url::get('sign');
     if (AZLib::checkBadWord($new_sign)) {
         $new_sign = '';
     }
     $full_name = Url::get('full_name');
     if (AZLib::checkBadWord($full_name)) {
         $full_name = '';
     }
     $address = Url::get('address');
     if (AZLib::checkBadWord($address)) {
         $address = '';
     }
     $home_phone = Url::get('home_phone');
     if (AZLib::checkBadWord($home_phone)) {
         $home_phone = '';
     }
     $fax = Url::get('fax');
     if (AZLib::checkBadWord($fax)) {
         $fax = '';
     }
     $mobile_phone = Url::get('mobile_phone');
     if (AZLib::checkBadWord($mobile_phone)) {
         $mobile_phone = '';
     }
     $website = Url::get('website');
     if (AZLib::checkBadWord($website)) {
         $website = '';
     }
     $yahoo_id = Url::get('yahoo_id');
     if (AZLib::checkBadWord($yahoo_id)) {
         $yahoo_id = '';
     }
     $skype_id = Url::get('skype_id');
     if (AZLib::checkBadWord($skype_id)) {
         $skype_id = '';
     }
     $arr = explode('-', Url::get('birth_day'));
     if (is_numeric($arr['0']) && is_numeric($arr['1']) && is_numeric($arr['2'])) {
         $strBirthDay = $arr['2'] . '-' . $arr['1'] . '-' . $arr['0'];
     } else {
         $strBirthDay = "";
     }
     $new_row = array('full_name' => $full_name, 'address' => $address, 'birth_day' => $strBirthDay, 'home_phone' => $home_phone, 'fax' => $fax, 'mobile_phone' => $mobile_phone, 'show_email' => $show_email, 'email_alert' => $email_alert, 'website' => $website, 'yahoo_id' => $yahoo_id, 'skype_id' => $skype_id, 'blast' => $new_blast, 'signature' => $new_sign, 'avatar_url' => $new_path);
     $id_new_row = DB::update('user', $new_row, 'id="' . User::id() . '"');
     @User::updateUserCache(User::id());
     if ($id_new_row) {
         echo "success";
         exit;
     } else {
         echo "unsuccess";
         exit;
     }
 }
开发者ID:duynhan07,项目名称:elink,代码行数:76,代码来源:ajax_personal.ajax.php

示例5: on_submit

 function on_submit()
 {
     $news_catid = Url::get('news_catid', 0);
     if (!$news_catid) {
         $this->setFormError('news_catid', "Bạn chưa chọn Danh mục cho Sản phẩm!");
     } else {
         $news_category = DB::select('news_categories', 'id=' . $news_catid);
         if (!$news_category) {
             $this->setFormError('news_catid', "Danh mục không tồn tại, mời bạn chọn Danh mục khác!");
         }
     }
     $title = Url::get('title');
     $brief = Url::get('brief', '');
     $content = Url::get('content', '');
     $hot = Url::get('hot', 0);
     $focus = Url::get('focus', 0);
     $status = Url::get('status', 2);
     //1:ẩn;2:hiện
     $image_title = Url::get('image_title');
     if ($status == 2) {
         $status = 1;
     } else {
         $status = 0;
     }
     /*if($image_title=='')
     		$image_title	=	AznetLib::convert_utf8_to_sms(AznetLib::subString($title,0,30,true));*/
     $pen_name = Url::get('pen_name');
     $source = Url::get('source', '');
     $get_source = Url::get('get_source', 0);
     $this->checkFormInput('Tiêu đề tin', "title", $title, 'str', true, '', 1, 255);
     $this->checkFormInput('Nội dung tóm tắt', "brief", $brief, 'str', true);
     $this->checkFormInput('Tiêu đề ảnh', "image_title", $image_title, 'str', false, '', 1, 100);
     $this->checkFormInput('Nội dung tin', "content", $content, 'str', true);
     if (!$this->errNum) {
         $news_image = array("name" => '', "img_server" => IMAGE_SERVER_NO, "title" => addslashes($image_title), 'time_create' => TIME_NOW, 'news_id' => 0, 'username' => User::user_name());
         if (isset($_FILES['main_image']) && $_FILES['main_image']['error'] == 0) {
             if ($_FILES['main_image']['name'] && getimagesize($_FILES['main_image']['tmp_name'])) {
                 $file_ext = AZLib::getExtension($_FILES['main_image']['name']);
                 if (in_array($file_ext, array('.jpg', '.jpeg', '.gif', '.png'))) {
                     if ($_FILES['main_image']['size'] <= Item::MAX_UPLOAD_SIZE) {
                         $uploadPath = AZLib::folderUpload(User::id(), "news");
                         $file_name = $uploadPath . date("YmdHis", TIME_NOW) . '_' . substr(AZLib::make_safe_name(basename(strtolower($_FILES['main_image']['name']), $file_ext)), 0, 36) . $file_ext;
                         if (AZLib::ftp_check_dir($uploadPath) && AZLib::ftp_image_put_file($file_name, $_FILES['main_image']['tmp_name'], IMAGE_SERVER_NO)) {
                             $news_image['name'] = $file_name;
                             $image_id = DB::insert('news_image', $news_image);
                             if ($image_id) {
                                 $news_image['id'] = $image_id;
                             } else {
                                 $this->setFormError('image', "Không cập nhật được <b>Ảnh đại diện</b>!");
                                 return;
                             }
                         } else {
                             $this->setFormError('image', "Không upload được <b>Ảnh đại diện</b>!");
                             return;
                         }
                     } else {
                         $this->setFormError('image', "Dung lượng ảnh quá lớn, dung lượng ảnh phải < 1 MB!");
                         return;
                     }
                 } else {
                     $this->setFormError('image', "Ảnh không đúng định dạng, chỉ chấp nhận các file .jpg, .jpeg, .gif, .png !");
                     return;
                 }
             } else {
                 $this->setFormError('image', "Lỗi <b>Ảnh đại diện</b>!");
                 return;
             }
         }
         if ($get_source) {
             //require_once('includes/news.php');
             //$content=News::convertContent(addslashes($content),$this->news['id']);
         }
         if ($brief == '') {
             $brief = AznetLib::subString($content, 0, 300, true);
         }
         $news_id = DB::insert('news', array('news_catid' => $news_catid, 'title' => addslashes($title), 'brief' => addslashes($brief), 'content' => addslashes($content), 'image' => $news_image['name'], 'image_title' => $news_image['title'], 'img_server' => $news_image['img_server'], 'status' => $status, 'pen_name' => addslashes($pen_name), 'source' => addslashes($source), 'get_source' => $get_source, 'time_created' => TIME_NOW, 'username' => User::user_name(), 'time_modify' => TIME_NOW, 'user_modify' => User::user_name(), 'hot' => $hot, 'focus' => $focus));
         if ($news_id) {
             if ($news_image['name'] && $news_image['id']) {
                 DB::update("news_image", array("news_id" => $news_id), "id={$news_image['id']}");
             }
             if (Url::get('href')) {
                 Url::redirect_url(urldecode(Url::get('href')));
             } else {
                 Url::redirect_current();
             }
         }
         $this->setFormError('title', "Không sửa được tin, mời bạn thử lại!");
     }
 }
开发者ID:duynhan07,项目名称:elink,代码行数:89,代码来源:NewsAdminAdd.php

示例6: list

    $user_id = (int) Url::get('user_id', 0);
    $user_name = '';
    $user = User::getUser($user_id);
    if ($user) {
        $user_name = $user['user_name'];
    }
} else {
    $user_id = User::id();
    $user_name = User::user_name();
}
$json['error'] = 'not_uploaded';
$json['id'] = 0;
$json['image_url'] = '';
if (User::is_login()) {
    if (User::is_az_team() || User::level() > 0) {
        $upload_path = AZLib::folderUpload($user_id);
        if (AZLib::ftp_check_dir($upload_path, true, IMAGE_SERVER_NO)) {
            //Check dir for upload
            $uploadFile = $_FILES["fast_upload_avatar"];
            if (isset($uploadFile) && $uploadFile['name']) {
                $file_name = $uploadFile['name'];
                $sourceName = $uploadFile['tmp_name'];
                $file_ext = AZLib::getExtension($file_name);
                if (in_array($file_ext, array('.jpg', '.jpeg', '.gif', '.png'))) {
                    if (!$uploadFile['error']) {
                        list($imagewidth, $imageheight, $imageType) = getimagesize($uploadFile['tmp_name']);
                        if ($imagewidth && $uploadFile['size'] <= Item::MAX_UPLOAD_SIZE) {
                            $img_url = $upload_path . date("YmdHis", TIME_NOW) . '_' . substr(AZLib::make_safe_name(basename(strtolower($file_name), $file_ext)), 0, 36) . $file_ext;
                            if (AZLib::ftp_image_put_file($img_url, $sourceName, IMAGE_SERVER_NO)) {
                                $image_id = DB::insert('item_image', array('des' => '', 'item_id' => 0, 'title' => '', 'position' => 0, 'img_server' => IMAGE_SERVER_NO, 'img_url' => $img_url, 'root_id' => 0, 'time' => TIME_NOW, 'user_id' => $user_id, 'user_name' => $user_name));
                                if ($image_id) {
开发者ID:duynhan07,项目名称:elink,代码行数:31,代码来源:ajax_upload.php


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