exploring/fileutility 问题修复 & 功能扩展

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

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

exploring/fileutility

Composer 安装命令:

composer require exploring/fileutility

包简介

File utility bundle

README 文档

README

This bundle aims to help management of files that were sent thought the form.

Symfony2 does a great job with converting raw file data into UploadedFile object and the goal of this bundle is to further extend it.

Installation (via composer)

To install FileUtilityBundle with Composer just add the following to your composer.json file:

{
    // ...
    require: {
        "exploring/fileutility": "dev-master"
    }
}

Please replace the "dev-master" with some concrete release.

Then run:

php composer.phar update

And register the bundle within AppKernel.php

$bundles = array(
    ....
    new Exploring\FileUtilityBundle\ExploringFileUtilityBundle(),
);

You are all set.

Configuration

The bundle uses several configutaion entries. However, the minimalistic configuation should look like:

exploring_file_utility:
    upload_root: %kernel.root_dir%/../web/uploads

All file are uploaded to a specific subdirectory of upload_root path. You can have as many subdirectories as you like.

You can read full configuration reference here.

Notice: Concept of directory "alias" has been removed in v2.0. Directories are now auto discovered during the warm up process. If you instantiate FileManager manually, you can still set available directories.

Advice: Either keep your upload root diretory out of web public directory or ensure proper access rights to file stored there in order to avoid execution of files uploaded.

Basic usage

You need to use service names exploring_file_utility.manager in order to gain access to FileManager:

$file = ...; // instance of UploadedFile
$fileManager = $this->get('exploring_file_utility.manager');
$fileDescriptor = $fileManager->save($file, 'foo');
$fileManager->commit();

The example above takes some arbitrary file and, given the configuration above, uploads it to /path/to/symfonyapp/web/uploads/foo.

FileManager's operations are transaction based. That means that any changes made to the file-system will be reverted back unless you callcommit():

You can invoke rollback() to revert any changes as well at any time:

$fileManager->rollback();

Examples

Various examples, both simple and advances, can be found in example document

Image manipulations

This bundle comes with some image manipulations operations built-in. Complete documentation on those can be found here

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-04-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固