定制 vria/enhanced-file 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

vria/enhanced-file

Composer 安装命令:

composer require vria/enhanced-file

包简介

Enhanced file type for Symfony forms

README 文档

README

Build Status

File type for Symfony forms with additional functionality:

  • if file has been previously uploaded, the download link is rendered
  • previously uploaded file can be deleted if new one is uploaded

##Installation

Using Composer, run:

composer require vria/enhanced-file

Add the VRiaNoDiacriticBundle to your application kernel:

// app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new VRia\Bundle\EnhancedFileBundle\VRiaEnhancedFileBundle(),
    );
}

##Use

In Symfony 3 you should use:

$form = $this->createFormBuilder()
    ->add('file', EnhancedFileType::class, $options)
    ...

While in Symfony ~2.3:

$form = $this->createFormBuilder()
    ->add('file', 'enhanced_file', $options)
    ...

$options is an array of options form FormType Field enlarged with:

  • directory_path - physycal directory to put files. E.g. $this->get('kernel')->getRootDir() . '/../web/upload/'. Required
  • public_directory_path - path from your public directory (often /web) to directory with files. E.g. '/upload/'. Required
  • delete_previous_file - whether to delete previously uploaded file. Default value is true

So, the complete definition could be:

$form = $this->createFormBuilder()
    ->add('file', EnhancedFileType::class, array(
        'label' => 'Curriculum vitae',
        'directory_path' => $this->get('kernel')->getRootDir() . '/../web/upload/',
        'public_directory_path' => '/upload/',
        'required' => false
    ))

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-04-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固