silverstripers/chunkuploader

Chunkupload,快速、同时上传

dev-master 2017-10-09 03:24 UTC

This package is auto-updated.

Last update: 2024-09-05 01:20:51 UTC


README

ChunkUploader 字段是 SilverStripe 表单字段类型,可以用于更快地上传大文件。它是用 Resumable.js 构建的,并支持多文件上传。

要求

  1. SilverStripe 3.6.*
  2. Flow PHP 服务器

用法

通过 composer 安装。

composer require silverstripers/chunkuploader dev-master

在表单中使用

在以下示例中,我们创建了一个包含 chunk 上传器的表单。

public function Form()
{
    $form = new Form($this, 'Form', new FieldList(
        ChunkUploadField::create('Files')
            ->setRightTitle('Upload your files here.')
    ), new FieldList(
        FormAction::create('doUpload')
    ), new RequiredFields());
    return $form;
}

public function doUpload($data, $form)
{
    $files = $data['Files']
}

$data['Files]' 返回文件 ID 的 CSV 列表。

Form

上述代码将使表单列出此截图。

待办事项

  1. 使用设置值使用保存的上传
  2. 控制上传的文件数量