承接 oleg-chulakov-studio/yii2-filesaver 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

oleg-chulakov-studio/yii2-filesaver

Composer 安装命令:

composer require oleg-chulakov-studio/yii2-filesaver

包简介

Yii2 behavior for saving file in model

README 文档

README

Russian

Install by composer

composer require oleg-chulakov-studio/yii2-filesaver

Or add this code into require section of your composer.json and then call composer update in console

"oleg-chulakov-studio/yii2-filesaver": "*"

Usage

  • In model add behavior
    public function behaviors()
    {
        return [
            ....
            [
                'class' => FileSaverBehavior::className(),
                'group_type' => 'photo',
                'in_attribute' => 'photoFile',
                'out_attribute' => 'photo_id',
                'del_attribute' => 'photoDel',
                'allowedExtensions' => [
                    'png',
                    'jpeg',
                    'jpg'
                ]
            ],
            ...
        ];
    }
  • In model add fields
/**
 * @var UploadedFile
/**
$photoFile;

 /**
  * @var boolean
 /**
$photoDel;

Example usage

  • saving by url
$model = new TestModel();
$model->photoFile = new \sem\filestorage\adapters\RemoteFile($url);
$model->save();
  • saving by upload in form
$model = new TestModel();
$model->photoFile = UploadedFile::getInstance($model, 'photoFile');
$model->save();

统计信息

  • 总下载量: 20
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 5
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD
  • 更新时间: 2017-07-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固