PHPackages                             sbyaute/symfony-dropzone - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. sbyaute/symfony-dropzone

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

sbyaute/symfony-dropzone
========================

Symfony Form Type

1.0.0(3y ago)0781MITTwig

Since Oct 27Pushed 3y ago1 watchersCompare

[ Source](https://github.com/sbyaute/symfony-dropzone)[ Packagist](https://packagist.org/packages/sbyaute/symfony-dropzone)[ RSS](/packages/sbyaute-symfony-dropzone/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Symfony DropzoneType
====================

[](#symfony-dropzonetype)

Étend le composant SymfonyForm. Ajoute le nouveau type de formulaire DropzoneType.

Installation
------------

[](#installation)

`composer require sbyaute/symfony-dropzone`

### Assets

[](#assets)

Ajoutez la bibliothèque dropzone à votre projet dans le template

```
{% block stylesheets %}
    {{ parent() }}

        .dropzone {
        min-height:25px;
        padding:5px 5px 5px
    }
        .dz-button {
        width:270px;
    }

{% endblock %}

{% block javascripts %}
    {{ parent() }}

{% endblock %}```

## Usage
```php
public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder, array $options)
{

    // fichiers is OneToMany
    $builder->add('fichiers', DropzoneType::class, [
        'class' => Fichier::class,
        'maxFilesize' => 8,  // Taille max du fichier en MB
        'maxFiles' => 6,        // Nb max de fichiers téléchargeables
        'uploadHandler' => 'uploadHandler', // route pour le chargement
        'removeHandler' => 'removeHandler', // route pour la suppression
        'downloadHandler' => 'downloadHandler', // route pour le téléchargement
        'previewsContainer' => true,        // Si true, sort la previsu de la dropzone (pas d'image)
        'choice_src' => 'src',              // Champ de l'entité contenant le nom du fichier sur le serveur
        'acceptedFiles' => '',        // Liste des types de fichiers autorisés ('.zip, .doc, .xls')
        'dictDefaultMessage' => 'Cliquez ou glissez/déposez vos fichiers ici ...',
        'dictRemoveFileConfirmation' => 'Etes-vous sûr ?', // active la confirmation de suppression
        'required' => false,
    ]);
}
```

Exemples route uploadHandler/removeHandler
------------------------------------------

[](#exemples-route-uploadhandlerremovehandler)

```
/**
     * @Route("/uploadhandler", name="uploadHandler")
     */
    public function uploadhandler(Request $request, ImageUploader $uploader) {
        $doc = $uploader->upload($request->files->get('file'));
        $file = new File();
        $file->setSrc($doc['src']);
        ...

        $this->getDoctrine()->getManager()->persist($file);
        $this->getDoctrine()->getManager()->flush();
        return new JsonResponse($file);
    }

    /**
     * @Route("/removeHandler/{id}", name="removeHandler")
     */
    public function removeHandler(Request $request,File $file = null) {
        $this->getDoctrine()->getManager()->remove($file);
        $this->getDoctrine()->getManager()->flush();
        return new JsonResponse(true);
    }
```

Options
-------

[](#options)

NameDefaultDescriptionclassnullFile Entitychoice\_src"src"property that contains srcuploadHandlernullSymfony route name for uploadremoveHandlernullSymfony route name for removemultipletrueSet to false if you have a one to one relationshipmaxFiles1If not null defines how many files this Dropzone handles.addRemoveLinkstrueIf true, this will add a link to every file preview to remove or cancel (if already uploading) the file.headers\[\]An optional object to send additional headers to the server. Headers is array. Eg: \['Authorization' =&gt; 'Bearer XXXXXX'\]formData\[\]Additional data that will be sent to FormData. Eg: \['key' =&gt; 'value'\]uploadHandlerMethod"POST"Can be changed to "PUT" if necessary.removeHandlerMethod"DELETE"Can be changed to "POST" if necessary.withCredentials0Will be set on the XHRequest.thumbnailWidth120If null, the ratio of the image will be used to calculate it.thumbnailHeight120The same as thumbnailWidth. If both are null, images will not be resized.thumbnailMethod"crop"How the images should be scaled down in case both, thumbnailWidth and thumbnailHeight are provided. Can be either contain or crop.resizeWidthnullIf set, images will be resized to these dimensions before being **uploaded**. If only one, resizeWidth **or** resizeHeight is provided, the original aspect ratio of the file will be preserved.resizeHeightnullSee resizeWidth.resizeMimeTypenullThe mime type of the resized image (before it gets uploaded to the server). If null the original mime type will be used. To force jpeg, for example, use image/jpeg. See resizeWidth for more information.resizeMethod"contain"How the images should be scaled down in case both, resizeWidth and resizeHeight are provided. Can be either contain or crop.filesizeBase1024-ignoreHiddenFilestrueWhether hidden files in directories should be ignored.acceptedFilesnullEg.: image/\*,application/pdf,.psdautoProcessQueuetrueIf false, files will be added to the queue but the queue will not be processed automatically. This can be useful if you need some additional user input before sending files (or if you want want all files sent at once). If you're ready to send the file simply call myDropzone.processQueue().autoQueuetrueIf false, files added to the dropzone will not be queued by default. You'll have to call enqueueFile(file) manually.previewsContainernullDefines where to display the file previews – if null the Dropzone element itself is used. Can be a CSS selector.License MIT
-----------

[](#license-mit)

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1291d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c69490954e0f338b8239883ba0173f5df9147370d0c4ea994db67b5d7ba12cb0?d=identicon)[sbyaute](/maintainers/sbyaute)

### Embed Badge

![Health badge](/badges/sbyaute-symfony-dropzone/health.svg)

```
[![Health](https://phpackages.com/badges/sbyaute-symfony-dropzone/health.svg)](https://phpackages.com/packages/sbyaute-symfony-dropzone)
```

###  Alternatives

[shyim/danger-php

Port of danger to PHP

8544.9k](/packages/shyim-danger-php)[symfony/ai-bundle

Integration bundle for Symfony AI components

30282.3k6](/packages/symfony-ai-bundle)[symfony/ux-cropperjs

Cropper.js integration for Symfony

19280.3k3](/packages/symfony-ux-cropperjs)[symfony/ux-notify

Native notification integration for Symfony

1274.7k](/packages/symfony-ux-notify)[numero2/contao-storelocator

Contao Plugin for managing stores (or in common address data) and providing a frontend-search based on geo data

121.5k](/packages/numero2-contao-storelocator)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
