ezsystems/ezplatform-multi-file-upload

为eZ Platform的多文件上传

安装次数: 107,865

依赖项: 0

建议者: 0

安全: 0

星标: 2

关注者: 26

分支: 6

语言:JavaScript

类型:ezplatform-bundle

v0.1.5 2018-04-10 09:16 UTC

README

允许一次性上传多个文件作为新内容项。

安装

  1. 从您的eZ Platform安装中,运行composer
$ composer require ezsystems/ezplatform-multi-file-upload
  1. 通过添加以下内容启用包:
new EzSystems\MultiFileUploadBundle\EzSystemsMultiFileUploadBundle(),

app/AppKernel.php

  1. 通过向 app/config/routing.yml 添加包配置来设置路由
 _eZPlatformMultiFileUpload:
     resource: "@EzSystemsMultiFileUploadBundle/Resources/config/routing.yml"
     prefix:   "%ezpublish_rest.path_prefix%"
  1. 使用 $ composer run-script post-update-cmd 清除缓存并设置资源

    (如果您使用prod环境,请确保首先设置了$ export SYMFONY_ENV=prod).

配置

示例应用程序配置(app/config/config.yml

# ...

ez_systems_multi_file_upload:
    location_mappings:
        -   # gallery
            content_type_identifier: gallery
            mime_type_filter:
                - video/*
                - image/*
            mappings:
                -   # images
                    mime_types:
                        - image/jpeg
                        - image/jpg
                        - image/pjpeg
                        - image/pjpg
                        - image/png
                        - image/bmp
                        - image/gif
                        - image/tiff
                        - image/x-icon
                        - image/webp
                    content_type_identifier: image  # content type of new items
                    content_field_identifier: image # field of content type to pass file to  
                    name_field_identifier: name     # field of content type to pass filename to
                -   # videos
                    mime_types:
                        - video/avi
                        - video/mpeg
                        - video/quicktime
                        - video/mp4
                        - video/webm
                        - video/3gpp
                        - video/x-msvideo
                        - video/ogg
                    content_type_identifier: video
                    content_field_identifier: file
                    name_field_identifier: name

    default_mappings:
        -   # file
            mime_types:
                - image/svg+xml
                - application/msword
                - application/vnd.openxmlformats-officedocument.wordprocessingml.document
                - application/vnd.ms-excel
                - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
                - application/vnd.ms-powerpoint
                - application/vnd.openxmlformats-officedocument.presentationml.presentation
                - application/pdf
            content_type_identifier: file
            content_field_identifier: file
            name_field_identifier: name

    fallback_content_type:
        content_type_identifier: file
        content_field_identifier: file
        name_field_identifier: name

默认包配置

parameters:
    ez_systems.multifile_upload.location_mappings: []

    ez_systems.multifile_upload.default_mappings:
        - # image
          mime_types:
            - image/jpeg
            - image/jpg
            - image/pjpeg
            - image/pjpg
            - image/png
            - image/bmp
            - image/gif
            - image/tiff
            - image/x-icon
            - image/webp
          content_type_identifier: image
          content_field_identifier: image
          name_field_identifier: name
        - # file
          mime_types:
            - image/svg+xml
            - application/msword
            - application/vnd.openxmlformats-officedocument.wordprocessingml.document
            - application/vnd.ms-excel
            - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
            - application/vnd.ms-powerpoint
            - application/vnd.openxmlformats-officedocument.presentationml.presentation
            - application/pdf
          content_type_identifier: file
          content_field_identifier: file
          name_field_identifier: name

    ez_systems.multifile_upload.fallback_content_type:
        content_type_identifier: file
        content_field_identifier: file
        name_field_identifier: name