• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP FileUploader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: upload

 public function upload()
 {
     global $varChecker;
     if ($varChecker->getValue('fileindex') !== false) {
         $fileindex = $varChecker->getValue('fileindex');
         $fileindex = empty($fileindex) ? 0 : $fileindex;
         $handle = $this->findFilehandle($fileindex);
     } else {
         $handle = $this->findFilehandle();
     }
     $uploader = new FileUploader($handle, true);
     $error = '';
     $path = 'cache/templates/' . $this->INK_User->getCustomer()->getSite()->getId() . '/';
     $fmaker = new FileMaker();
     $fmaker->makeDirectory($path, false);
     //upload the file
     try {
         //upload to cms
         $path = $uploader->upload($path);
         //upload to client server
         $result = array('success' => 'file_uploaded', 'filepath' => $path, 'msg' => 'file uploaded');
     } catch (Exception $e) {
         $result = array('error' => $e->getMessage());
     }
     echo json_encode($result);
 }
开发者ID:ruffen,项目名称:Pixcel-CMS,代码行数:26,代码来源:files.controller.php


示例2: header_image

function header_image()
{
    $header_image_action = $_POST['header_image_option'];
    $display_header_image = $_POST['desktop_image_display'];
    if (!empty($_FILES['headerphoto']['name']) && empty($_POST['restore_default'])) {
        $uploadfile = PA::$upload_path . basename($_FILES['headerphoto']['name']);
        $myUploadobj = new FileUploader();
        //creating instance of file.
        $image_type = 'image';
        $file = $myUploadobj->upload_file(PA::$upload_path, 'headerphoto', true, true, $image_type);
        if ($file == false) {
            throw new PAException(GROUP_PARAMETER_ERROR, "File upload error: " . $myUploadobj->error);
        }
        $header_image = $file;
        $header_img = array('display_header_image' => $display_header_image, 'header_image_action' => $header_image_action, 'header_image' => $header_image);
        return $header_img;
    }
    if (isset($_POST['restore_default'])) {
        $header_image = NULL;
        $header_img = array('display_header_image' => $display_header_image, 'header_image_action' => $header_image_action, 'header_image' => $header_image);
        return $header_img;
    }
    $header_img = array('display_header_image' => $display_header_image, 'header_image_action' => $header_image_action);
    return $header_img;
}
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:25,代码来源:group_functions.php


示例3: changeSlide

 public function changeSlide($fileName)
 {
     // folder for uploaded files
     $tempFolder = Yii::app()->basePath . DIRECTORY_SEPARATOR . '..' . Yii::app()->params['folders']['temp'];
     if (!is_writable($tempFolder)) {
         throw new CException('temporary folder is not exists or not writable. Path:' . $tempFolder);
     }
     $uploader = new FileUploader(Yii::app()->params['uploader']['allowedFileExtensions'], Yii::app()->params['uploader']['sizeLimit']);
     $result = $uploader->handleUpload($tempFolder);
     if (!isset($result['error'])) {
         $imageHandler = new CImageHandler();
         $imageHandler->load($tempFolder . $result['filename']);
         try {
             $imageHandler->cropAndScaleFromCenter(1040, 380);
             $imageHandler->save($this->getSliderImagePath($fileName));
             $this->response = array('fileName' => $fileName, 'imageSrc' => $this->getSliderImageSrc($fileName));
             return TRUE;
         } catch (CException $e) {
             $this->response = array('errorMessage' => $fileName . $e->getMessage());
             return FALSE;
         }
     } else {
         $this->response = array('errorMessage' => $result['error']);
         return FALSE;
     }
 }
开发者ID:andrelinoge,项目名称:rezydent,代码行数:26,代码来源:SliderModel.php


示例4: handle_uploaded_avatar_pic

 function handle_uploaded_avatar_pic()
 {
     if (!empty($_FILES['userfile']['name'])) {
         $uploadfile = PA::$upload_path . basename($_FILES['userfile']['name']);
         $myUploadobj = new FileUploader();
         //creating instance of file.
         $image_type = 'image';
         $file = $myUploadobj->upload_file(PA::$upload_path, 'userfile', true, true, $image_type);
         if ($file == false) {
             $this->reg_user->msg = $myUploadobj->error;
             $this->reg_user->error = TRUE;
         } else {
             $_POST['user_filename'] = $file;
         }
     } else {
         // IF THE UPLOAD FIELD WAS EMPTY CHECK FOR THE URL FIELD
         $avatar_url = trim(@$_REQUEST['avatar_url']);
         if (!empty($avatar_url) && preg_match("|http://(.*?)/(.*)|", $avatar_url, $m)) {
             //TODO: change to use FileUploader or new storage code.
             list(, $uf_server, $uf_path) = $m;
             $uf_basename = preg_replace("[^A-Za-z0-9\\-_\\.]", "_", basename($uf_path));
             //FETCH THE IMAGE VIA HTTP AND WRITE IT WHERE AN UPLOADED FILE WOULD GO
             $uploadfile = PA::$upload_path . $uf_basename;
             if ($this->reg_user->download($avatar_url, $uploadfile)) {
                 $_POST['user_filename'] = $uf_basename;
                 $_POST['avatar_url'] = '';
             } else {
                 $this->reg_user->msg = "Could not retrieve file from URL:" . $avatar_url;
                 $this->reg_user->error = TRUE;
             }
         }
     }
 }
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:33,代码来源:register.php


示例5: handle_uploaded_avatar_pic

 function handle_uploaded_avatar_pic()
 {
     if (isset($_POST['user_filename'])) {
         $_POST['user_filename'] = Storage::validateFileId($_POST['user_filename']);
     }
     if (!empty($_FILES['userfile']['name'])) {
         // process uploaded image file
         $myUploadobj = new FileUploader();
         $file = $myUploadobj->upload_file(PA::$upload_path, 'userfile', true, true, 'image');
         if (!$file) {
             throw new PAException(FILE_NOT_UPLOADED, $myUploadobj->error);
         }
     } else {
         // download given image url
         $avatar_url = trim(@$_REQUEST['avatar_url']);
         if (!empty($avatar_url) && preg_match("|http://(.*?)/(.*)|", $avatar_url, $m)) {
             list(, $uf_server, $uf_path) = $m;
             $file = Storage::save($avatar_url, basename($uf_path), "critical", "image");
             if (!$file) {
                 throw new PAException(FILE_NOT_UPLOADED, sprintf(__("Could not retrieve file from URL: %s"), $avatar_url));
             }
         }
     }
     if (@$file) {
         $_POST['user_filename'] = $file;
         $_POST['avatar_url'] = '';
     }
 }
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:28,代码来源:RegistrationPage.php


示例6: upload_file

 function upload_file()
 {
     $name = $_FILES['file']['name'];
     $file = $_FILES['file'];
     $fileUploader = new FileUploader($file, $name);
     $json = $fileUploader->uploadFile();
     echo $json;
 }
开发者ID:mawilliamson,项目名称:version-control,代码行数:8,代码来源:VersionPostPage.php


示例7: do_file_upload

function do_file_upload()
{
    $uploadfile = PA::$upload_path . basename($_FILES['network_image']['name']);
    $myUploadobj = new FileUploader();
    //creating instance of file.
    $image_type = 'image';
    $file = $myUploadobj->upload_file(PA::$upload_path, 'network_image', true, true, $image_type);
    if ($file == false) {
        $r = array('error' => TRUE, 'error_msg' => $myUploadobj->error);
    } else {
        $r = array('error' => FALSE, 'file' => $file);
    }
    return $r;
}
开发者ID:Cyberspace-Networks,项目名称:CoreSystem,代码行数:14,代码来源:cnnetwork.php


示例8: updateLogo

 /**
  * 更新LOGO
  *
  * @return bool
  */
 public function updateLogo()
 {
     if (!isset($_FILES['qqfile'])) {
         return true;
     }
     $uploader = new FileUploader();
     $result = $uploader->handleUpload('brand');
     if (isset($result['success'])) {
         if ($this->id_image > 0) {
             $image = new Image($this->id_image);
             if (Validate::isLoadedObject($image)) {
                 $image->delete();
             }
         }
         $this->id_image = $result['success']['id_image'];
         return $this->update();
     }
     return false;
 }
开发者ID:yiuked,项目名称:tmcart,代码行数:24,代码来源:Carrier.php


示例9: uploadMedia

 /**
  * Upload media file ,like: image/flash
  *
  * @author  John.meng (цот╤РШ)
  * @since   version - 2006-1-7 12:56:23
  * @param   string  
  *
  */
 function uploadMedia($CurrentUserPathImages, $oldPic = "", $PicType = "Pic", $newWidth = "", $newHeight = "", $CreateIco = false, $IcoWidth = "", $IcoHeight = "")
 {
     $allowed_mimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'application/x-shockwave-flash');
     $maxfilesize = 10000000;
     $FileUploaderObj = new FileUploader($CurrentUserPathImages, $allowed_mimetypes, $maxfilesize);
     $FileUploaderObj->newWidth = $newWidth;
     $FileUploaderObj->newHeight = $newHeight;
     if ($CreateIco && $IcoWidth && $IcoHeight) {
         $FileUploaderObj->CreateIco = $CreateIco;
         $FileUploaderObj->IcoWidth = $IcoWidth;
         $FileUploaderObj->IcoHeight = $IcoHeight;
     }
     if ($_FILES[$PicType]['name'] != "") {
         if ($FileUploaderObj->fetchMedia($PicType)) {
             $FileUploaderObj->setPrefix($PicType . "_");
             if (!$FileUploaderObj->upload()) {
                 echo $FileUploaderObj->getErrors();
             } else {
                 $StrPic = $FileUploaderObj->getSavedFileName();
                 if ($oldPic) {
                     @unlink($CurrentUserPathImages . "/" . $oldPic);
                 }
             }
         }
     } else {
         $StrPic = $oldPic;
     }
     return $StrPic;
 }
开发者ID:BackupTheBerlios,项目名称:flushcms,代码行数:37,代码来源:FileUploadHandle.class.php


示例10: ajaxProcessAddImage

/**
 * 上传图片并更新排序
 */
function ajaxProcessAddImage()
{
    // max file size in bytes
    $uploader = new FileUploader();
    $result = $uploader->handleUpload(ImageType::IMAGE_PRDOCUT);
    if (isset($result['success'])) {
        $image = $result['success'];
        $row['id_product'] = Tools::Q('id_product');
        $row['id_image'] = (int) $image['id_image'];
        $row['position'] = (int) Product::getImageLastPosition($row['id_product']);
        if ($row['position'] == 1) {
            $row['cover'] = 1;
        } else {
            $row['cover'] = 0;
        }
        Db::getInstance()->insert(DB_PREFIX . 'product_to_image', $row);
        $json = array('status' => 'ok', 'id' => $row['id_image'], 'path' => Image::getImageLink($row['id_image'], 'small'), 'position' => $row['position'], 'cover' => $row['cover']);
        die(json_encode($json));
    } else {
        die(json_encode($result));
    }
}
开发者ID:yiuked,项目名称:tmcart,代码行数:25,代码来源:ajax-img.php


示例11: uploadFileLocal

 public static function uploadFileLocal($fieldName, $fileName = null)
 {
     $fileInfo = self::getFileInfo($fieldName);
     if ($fileInfo === null) {
         return null;
     }
     // Upload all file to storage directory. Its temporary.
     $type = 'files';
     $uploadedFileName = $fileName == null ? $fileInfo->getName() : $fileName;
     $dstPath = FileUploader::getStorageDirectory($type) . $uploadedFileName;
     if (!$fileInfo->saveAs($dstPath)) {
         return null;
     }
     return $type . '/' . $uploadedFileName;
 }
开发者ID:rosko,项目名称:AlmazService,代码行数:15,代码来源:FileUploader.php


示例12: run

 public function run()
 {
     // folder for uploaded files
     $tempFolder = Yii::app()->basePath . DIRECTORY_SEPARATOR . '..' . $this->tempFolder;
     if (!is_writable($tempFolder)) {
         throw new CException('temporary folder is not exists or not writable. Path:' . $tempFolder);
     }
     $uploader = new FileUploader($this->allowedFileExtensions, $this->fileLimit);
     $result = $uploader->handleUpload($tempFolder);
     if (!isset($result['error'])) {
         $imageHandler = new CImageHandler();
         $imageHandler->load($tempFolder . $result['filename']);
         try {
             // if min/max weight/height are set - check those conditions
             $this->validateImageDimensions($imageHandler->getWidth(), $imageHandler->getHeight());
             $this->getController()->successfulAjaxResponse(array('fileName' => $imageHandler->getBaseFileName(), 'imageSrc' => '/application' . $this->tempFolder . $imageHandler->getBaseFileName()));
         } catch (CException $e) {
             $errorMsg = $imageHandler->getBaseFileName() . ' - ' . $e->getMessage();
             $this->getController()->unsuccessfulAjaxResponse(array('errorMessage' => $errorMsg));
         }
     } else {
         $this->getController()->unsuccessfulAjaxResponse(array('errorMessage' => $result['error']));
     }
 }
开发者ID:andrelinoge,项目名称:rezydent,代码行数:24,代码来源:UploadImageAction.php


示例13: addAttachment

 /**
  * 
  * @param array $file e.g. $_FILES['photo']
  * @return ConversationAttachment
  */
 public function addAttachment($file)
 {
     $systemFilename = self::findNewFileName($this->config->uploadDir);
     $attachsImgUpConfig = $this->config->imageUploaderConfig;
     $attachsImgUpConfig->uploadDir = $this->config->uploadDir;
     if (in_array($file["type"], $attachsImgUpConfig->acceptedMimeTypes->toArray())) {
         ImageUploader::upload($file, $systemFilename, $attachsImgUpConfig);
     } else {
         FileUploader::upload($file, $systemFilename, $this->config->uploadDir);
     }
     $qb = new QueryBuilder();
     $qb->insert(Tbl::get('TBL_CONVERSATION_ATTACHEMENTS'))->values(array('system_filename' => $systemFilename, 'filename' => $file['name'], 'mime_type' => $file['type']));
     $attachmentId = $this->query->exec($qb->getSQL())->getLastInsertId();
     $filter = new ConversationAttachmentFilter();
     $filter->setId($attachmentId);
     return $this->getAttachment($filter);
 }
开发者ID:alexamiryan,项目名称:stingle,代码行数:22,代码来源:ConversationAttachmentManager.class.php


示例14: upload

 /**
  * @copydoc FileUploader::upload
  *
  * @throws SystemException 'ERR_BAD_FILE_FORMAT'
  */
 public function upload($dir)
 {
     if ($this->getExtension() != 'flv' && file_exists($this->getConfigValue('video.ffmpeg'))) {
         $cmd = $this->getConfigValue('video.ffmpeg') . ' -i ' . $this->file['tmp_name'] . ' -f flv -y  -ar 22050 -ab 32 -b 700000 -s cif ' . ($this->FileObjectName = $this->generateFilename($dir, 'flv'));
         $returnStatus = false;
         /*$result = */
         system($cmd, $returnStatus);
         if ($returnStatus) {
             throw new SystemException('ERR_BAD_FILE_FORMAT', SystemException::ERR_CRITICAL, $this->file['name']);
         }
         $cmd = $this->getConfigValue('video.ffmpeg') . ' -i ' . $this->file['tmp_name'] . ' -vframes 1 -ss 00:00:05' . ' -f image2 -s cif -an ' . $this->FileObjectName . '.jpg';
         system($cmd);
         $result = true;
     } else {
         $result = parent::upload($dir);
     }
     return $result;
 }
开发者ID:energine-cmf,项目名称:energine,代码行数:23,代码来源:VideoUploader.php


示例15: __

                 }
             }
         }
     }
 }
 //code for fields which are common to some sections like description, image
 if ($section == 'video_tours' || $section == 'register_today' || $section == 'network_of_moment' || $section == 'server_announcement' || $section == 'showcase') {
     if (empty($_POST['description'])) {
         $message[] = __('No description provided for network of moment');
     } else {
         $networks_data['description'] = $_POST['description'];
     }
     $image_file = 'network_image';
     if (!empty($_FILES[$image_file]['name'])) {
         //validating and then uploading the network image.
         $uploader = new FileUploader();
         //creating instance of file.
         $file = $uploader->upload_file(PA::$upload_path, $image_file, true, true, 'image');
         if ($file == false) {
             $message[] = __(' For network of moment, ') . $uploader->error;
             $networks_data['network_image'] = null;
         } else {
             $networks_data['network_image'] = $file;
         }
     } else {
         if (!empty($_POST['current_network_image'])) {
             //getting the previously added image from the hidden form field.
             $networks_data['network_image'] = $_POST['current_network_image'];
         } else {
             //setting the image to null.
             $networks_data['network_image'] = null;
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:31,代码来源:configure_splash_page.php


示例16: initializeModule

 function initializeModule($request_method, $request_data)
 {
     global $error_msg;
     $error = false;
     $msg = array();
     $form_data = NULL;
     $edit = false;
     $message = NULL;
     // check permissions!
     $user_may = false;
     $user_may = PermissionsHandler::can_user(PA::$login_uid, array('permissions' => 'manage_ads'));
     // check for manageads of group permissions
     if (!empty($_REQUEST['gid']) && !$user_may) {
         // we do this checl only if the user is not already permitted to manage ads
         $gp_access = PermissionsHandler::can_group_user(PA::$login_uid, $_REQUEST['gid'], array('permissions' => 'manage_ads'));
         $user_may = $gp_access;
     }
     if (!$user_may) {
         $error_msg = __("You do not have permission to manage Ads.");
         return "skip";
     }
     // paging
     if (!empty($request_data['page'])) {
         $this->Paging["page"] = (int) $request_data['page'];
     }
     if (!empty($request_data['action']) && $request_data['action'] == 'edit' && !empty($request_data['ad_id'])) {
         $edit = TRUE;
         $res = Advertisement::get($params = NULL, $condition = array('ad_id' => (int) $request_data['ad_id']));
         if (!empty($res)) {
             $form_data['ad_id'] = $res[0]->ad_id;
             $form_data['ad_image'] = $res[0]->ad_image;
             $form_data['ad_script'] = $res[0]->ad_script;
             $form_data['ad_url'] = $res[0]->url;
             $form_data['ad_title'] = $res[0]->title;
             $form_data['ad_description'] = $res[0]->description;
             $form_data['ad_page_id'] = $res[0]->page_id;
             $form_data['orientation'] = $res[0]->orientation;
             $form_data['created'] = $res[0]->created;
         }
     } else {
         if (!empty($request_data['action']) && $request_data['action'] == 'delete' && !empty($request_data['ad_id'])) {
             if (!empty($request_data['ad_id'])) {
                 try {
                     Advertisement::delete((int) $request_data['ad_id']);
                     $error_msg = 19013;
                 } catch (CNException $e) {
                     $msg[] = $e->message;
                 }
             }
         } else {
             if (!empty($request_data['action']) && !empty($request_data['ad_id'])) {
                 $update = false;
                 switch ($request_data['action']) {
                     case 'disable':
                         $field_value = DELETED;
                         $msg_id = 19010;
                         $update = true;
                         break;
                     case 'enable':
                         $field_value = ACTIVE;
                         $msg_id = 19011;
                         $update = true;
                         break;
                 }
                 if ($update) {
                     $update_fields = array('is_active' => $field_value);
                     $condition = array('ad_id' => $request_data['ad_id']);
                     try {
                         Advertisement::update($update_fields, $condition);
                         $error_msg = $msg_id;
                     } catch (CNException $e) {
                         $msg[] = $e->message;
                     }
                 }
             }
         }
     }
     $advertisement = new Advertisement();
     if (!$error && $request_method == 'POST' && $request_data['btn_apply_name']) {
         // if page is submitted
         if (!empty($request_data['ad_id'])) {
             $advertisement->ad_id = $request_data['ad_id'];
             $advertisement->created = $request_data['created'];
             $msg_id = 19007;
         } else {
             $msg_id = 19008;
             $advertisement->created = time();
         }
         if (!empty($_FILES['ad_image']['name'])) {
             $filename = $_FILES['ad_image']['name'];
             $uploadfile = PA::$upload_path . basename($filename);
             $myUploadobj = new FileUploader();
             $file = $myUploadobj->upload_file(PA::$upload_path, 'ad_image', TRUE, TRUE, 'image');
             $advertisement->ad_image = $form_data['ad_image'] = $file;
             if ($file == FALSE) {
                 $error = TRUE;
                 $msg[] = $myUploadobj->error;
             }
         } else {
             if (!empty($request_data['ad_id'])) {
//.........这里部分代码省略.........
开发者ID:Cyberspace-Networks,项目名称:CoreSystem,代码行数:101,代码来源:CNManageAdCenterModule.php


示例17: create_new_network

function create_new_network($_form)
{
    // function checks initial settings for network creation
    $can_network_be_created = Network::can_network_be_created();
    if ($can_network_be_created['error'] == TRUE) {
        $config_error = TRUE;
        $error = TRUE;
        $error_msg = $can_network_be_created['error_msg'];
    } else {
        if (!PA::$login_uid) {
            $config_error = TRUE;
        }
    }
    //form_data is array used for form fields
    // its initialized by $_form
    $temp_data['action'] = 'add';
    $vartoset = array('address', 'name', 'tagline', 'category', 'desc', 'header_image', 'header_image_option', 'action', 'type', 'network_group_title', 'network_content_moderation');
    for ($i = 0; $i < count($vartoset); $i += 1) {
        $var = $vartoset[$i];
        if (!empty($_form[$var])) {
            $temp_data[$var] = trim($_form[$var]);
        }
        if ($var == 'type') {
            if (isset($_form[$var])) {
                $temp_data[$var] = $_form[$var];
            }
        }
    }
    if (empty($config_error)) {
        filter_all_post($_form);
        //filters all data of html
        $error_post = check_error();
        //validation check
        if ($error_post['error'] == TRUE) {
            $error = TRUE;
            $error_msg = $error_post['error_msg'];
        }
        if (!$error_post) {
            //upload file
            if (!empty($_FILES['network_image']['name'])) {
                $file_upload_result = do_file_upload();
                if ($file_upload_result['error']) {
                    $error = TRUE;
                    $error_msg = $file_upload_result['error_msg'];
                } else {
                    $header_image = $network_image = $file_upload_result['file'];
                }
            } else {
                //image hidden
                $header_image = $network_image = @$temp_data['header_image'];
            }
            //code to upload the icon image
            if (!empty($_FILES['inner_logo_image']['name'])) {
                $uploadfile = PA::$upload_path . basename($_FILES['inner_logo_image']['name']);
                $myUploadobj = new FileUploader();
                //creating instance of file.
                $image_type = 'image';
                $file = $myUploadobj->upload_file(PA::$upload_path, 'inner_logo_image', true, true, $image_type);
                if ($file == false) {
                    $error = TRUE;
                    $error_msg = $file_upload_result['error_msg'];
                    unset($data_icon_image);
                } else {
                    $data_icon_image = array('inner_logo_image' => $file);
                }
            } else {
                unset($data_icon_image);
            }
            //...code to upload the icon image
            $network_basic_controls = PA::$network_defaults;
            $network_basic_controls['basic']['header_image']['name'] = $header_image;
            $network_basic_controls['basic']['header_image']['option'] = @$_form['header_image_option'] ? $_form['header_image_option'] : DESKTOP_IMAGE_ACTION_STRETCH;
            // for title of network group
            $network_basic_controls['network_group_title'] = '';
            $network_basic_controls['network_group_title'] = $_form['network_group_title'];
            $network_basic_controls['network_content_moderation'] = @$_form['network_content_moderation'];
            $temp_data['address'] = strtolower($temp_data['address']);
            $data = array('user_id' => $_SESSION['user']['id'], 'name' => strip_tags($temp_data['name']), 'address' => $temp_data['address'], 'tagline' => strip_tags($temp_data['tagline']), 'category_id' => $temp_data['category'], 'type' => $temp_data['type'], 'description' => $temp_data['desc'], 'extra' => serialize($network_basic_controls), 'created' => time(), 'changed' => time());
            //add icon image
            if (!empty($data_icon_image['inner_logo_image'])) {
                $data = array_merge($data, $data_icon_image);
                $temp_data['inner_logo_image'] = $data_icon_image['inner_logo_image'];
            }
            $network = new Network();
            $network->set_params($data);
            try {
                $nid = $network->save();
                //default_page_setting($network->address); // populate page_default setting
            } catch (PAException $e) {
                $error = TRUE;
                $error_msg = "{$e->message}";
            }
            if (!empty($nid)) {
                $_extra = serialize(array('user' => true, 'network' => true, 'groups' => array()));
                Roles::set_user_role_for_network($network->user_id, ADMINISTRATOR_ROLE, $network->address, $_extra);
                $location = "http://" . $temp_data['address'] . '.' . PA::$domain_suffix . BASE_URL_REL . PA_ROUTE_CONFIGURE_NETWORK;
            }
        }
        $msg_array = array();
        $msg_array['failure_msg'] = @$error_msg;
//.........这里部分代码省略.........
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:101,代码来源:action.php


示例18: array_key_exists

<?php

$type = array_key_exists('type', $_POST) ? $_POST['type'] : null;
$marker = array_key_exists('marker', $_POST) ? $_POST['marker'] : null;
if (!$type) {
    die('Bad type given.');
}
//MD5_STR_LENGTH ещё использовать нельзя, так как Defines не подключен
if (!$marker || strlen($marker) <= 32) {
    die('Bad marker given.');
}
$sessionId = substr($marker, 32);
session_id($sessionId);
require_once 'AjaxTools.php';
check_user_session_marker($marker);
try {
    FileUploader::inst($type)->assertAutonomous();
    FileUploader::inst($type)->saveUploadedFile(true, null, $_POST);
} catch (Exception $ex) {
    PsLogger::inst('AjaxFileUpload')->info('Ошибка загрузки файла');
    PsLogger::inst('AjaxFileUpload')->info($ex->getTraceAsString());
    ExceptionHandler::dumpError($ex);
}
开发者ID:ilivanoff,项目名称:www,代码行数:23,代码来源:FileUpload.php


示例19: FileUploader

 //filters all data of html
 for ($i = 0; $i < count($vartoset); $i += 1) {
     $var = $vartoset[$i];
     if (!empty($_POST[$var])) {
         $form_data[$var] = $_POST[$var];
     }
 }
 if ($error == FALSE) {
     $newuser->login_name = $login_name;
     $newuser->password = $password;
     $newuser->first_name = $first_name;
     $newuser->last_name = $last_name;
     $newuser->email = $email;
     $newuser->is_active = ACTIVE;
     if (!empty($_FILES['userfile']['name'])) {
         $myUploadobj = new FileUploader();
         //creating instance of file.
         $image_type = 'image';
         $file = $myUploadobj->upload_file(PA::$upload_path, 'userfile', true, true, $image_type);
         if ($file == false) {
             $msg = $myUploadobj->error;
             $error = TRUE;
         } else {
             $newuser->picture = $file;
         }
     }
     if ($error == FALSE) {
         try {
             $newuser->save();
             if (!empty($file)) {
                 Storage::link($file, array("role" => "avatar", "user" => $newuser->user_id));
开发者ID:Cyberspace-Networks,项目名称:CoreSystem,代码行数:31,代码来源:cnuser_by_admin.php


示例20: changeAvatar

 /**
  * Upload and apply new avatar
  * @return bool
  * @throws CException
  */
 public function changeAvatar()
 {
     // folder for uploaded files
     $tempFolder = Yii::app()->basePath . DIRECTORY_SEPARATOR . '..' . Yii::app()->params['folders']['temp'];
     $avatarsFolder = Yii::app()->basePath . DIRECTORY_SEPARATOR . '..' . Yii::app()->params['folders']['userAvatars'];
     if (!is_writable($tempFolder)) {
         throw new CException('temporary folder is not exists or not writable. Path:' . $tempFolder);
     }
     // Upload to temp folder
     $uploader = new FileUploader(Yii::app()->params['uploader']['allowedFileExtensions'], Yii::app()->params['uploader']['sizeLimit']);
     $result = $uploader->handleUpload($tempFolder);
     if (!isset($result['error'])) {
         // Move file to target folder and make thumbs
         $imageHandler = new CImageHandler();
         $imageHandler->load($tempFolder . $result['filename']);
         try {
             $imageHandler->save($avatarsFolder . $result['filename']);
             $imageHandler->cropAndScaleFromCenter(self::SMALL_THUMB_WIDTH, self::SMALL_THUMB_HEIGHT);
             $imageHandler->save($avatarsFolder . self::THUMB_PREFIX_SMALL . $result['filename']);
             $imageHandler->load($tempFolder . $result['filename']);
             $imageHandler->cropAndScaleFromCenter(self::MICRO_THUMB_WIDTH, self::MICRO_THUMB_HEIGHT);
             $imageHandler->save($avatarsFolder . self::THUMB_PREFIX_MICRO . $result['filename']);
             if ($this->hasPhoto()) {
                 $this->_removeOldPhoto();
             }
             $this->photo = $result['filename'];
             $this->_response = array('originalSrc' => $this->getOriginalPhoto(), 'thumbSrc' => $this->getSmallThumbnail());
             $this->save(FALSE);
             return TRUE;
         } catch (CException $e) {
             $this->_response = array('errorMessage' => $e->getMessage());
             return FALSE;
         }
     } else {
         $this->_response = array('errorMessage' => $result['error']);
         return FALSE;
     }
 }
开发者ID:andrelinoge,项目名称:rezydent,代码行数:43,代码来源:User.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP FileUtil类代码示例发布时间:2022-05-23
下一篇:
PHP FileUpload类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap