Skip to content

Drag and drop don't work #151

@rflorent

Description

@rflorent

Hello,

I'm using this great bundle, wihtout admingenerator, and thanks for it.
I try ti use upload collection but I ran into issues.
I can drag and drop files, row are added, with preview and informations.
But files are not uploaded, data['uploads'] is always empty.
If I use file input to choose file, everything works, but I can't add more than one file.

I need somes help.

My config.yml

knp_gaufrette:
    stream_wrapper: ~

    adapters:
        object_file_adapter:
            local:
                directory: %kernel.root_dir%/../../web/uploads

    filesystems:
        object_file_fs:
            adapter:    object_file_adapter

vich_uploader:
    db_driver: orm

    gaufrette: true
    storage:   vich_uploader.storage.gaufrette

    mappings:
        object_files:
            uri_prefix:         /files
            upload_destination: object_file_fs
            namer: vich_uploader.namer_uniqid
            inject_on_load:       true
            delete_on_remove:     true
            delete_on_update:     true

avocode_form_extensions:
    upload_manager:        vich_uploader

Entity ObjectFile

<?php
/**
 * @Vich\UploadableField(mapping="object_files", fileNameProperty="path")
 * @var \Symfony\Component\HttpFoundation\File\File
 */
protected $file;

/**
 * @ORM\Column(type="string", length=255, nullable=true)
 */
protected $path;

Form OjectFile

<?php
$builder
    ->add('id', 'integer',  array(
        'required' => true,
        'label'    => 'Id',
    ))
    ->add('name', 'text', array(
        'label'    => 'Nom',
        'required' => false,
    ))
    ->add('description', 'textarea', array(
        'label'    => 'Description',
        'required' => false
    ))
    ->add('file', 'file');

Form Parent

<?php
 $builder->add('objectFiles', 'afe_collection_upload', array(
    'allow_add'         => true,
    'allow_delete'      => true,
    'by_reference'      => false,
    'type'              => "atm_object_file",
    'maxNumberOfFiles'  => 5,
    'maxFileSize'       => 500000,
    'acceptFileTypes'   => '/(\.|\/)(pdf|gif|jpe?g|png|doc|docx|xls|xlsx|odt|ppt|pptx)$/i',
    'error_bubbling'    => false,
    'options'           => array(
        'data_class' => 'Atm\\Bundle\\CoreBundle\\Entity\\ObjectFile',
    )
));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions