fm-labs/cakephp-upload 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

fm-labs/cakephp-upload

Composer 安装命令:

composer require fm-labs/cakephp-upload

包简介

Upload plugin for CakePHP

README 文档

README

Simple file upload plugin for CakePHP4

Installation

$ composer require fm-labs/cakephp-upload

Usage

// Example Controller

class UploadController extends \Cake\Controller\Controller
{
    public function upload()
    {
        // create Uploader instance
        $uploader = new \Upload\Uploader([]);
        // alternatively the uploader config can be loaded from a config file
        // (copy example config from PLUGIN/config/upload.sample.php to app/config/upload.php)
        //\Cake\Core\Configure::load('upload');
        //$uploader = new \Upload\Uploader('default');
    
        // process the uploaded data
        $uploader->upload($this->getRequest()->getData('uploadfile'));
        
        // the result is a list of uploaded files
        // [[
        //  'name' => '/path/to/file',
        //  'size' => (int) 1234,
        //  'mime_type' => 'text/plain'
        //  'error' => 0
        // ], [...]]
        $result = $uploader->getResult();
    }

}
// Example upload form using CakePHP FormHelper
<?= $this->Form->create(null); ?>
<?= $this->Form->input('uploadfile', ['type' => 'file']; ?>
<?= $this->Form->submit('Upload'); ?>
<?= $this->Form->end(); ?>

// Example upload form using plain html
<form method="POST" action="/url/to/upload-controller/">
<input name="uploadfile" type="file" />
<input type="submit" value="Upload" />
</form>

Run tests

$ composer run test

Changelog

[1.3]

  • Migrations for CakePHP 4.0

[1.2]

  • Migrations for CakePHP 3.8

[1.1]

  • Added uploader option 'saveAs'
  • Refactored uploader with InstanceConfigTrait

[1.0]

  • Requires CakePHP 3.3

License

See LICENSE file

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unlicense
  • 更新时间: 2020-04-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固