PHPackages                             pvlkns/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. [Templating &amp; Views](/categories/templating)
4. /
5. pvlkns/symfony-dropzone

ActiveLibrary[Templating &amp; Views](/categories/templating)

pvlkns/symfony-dropzone
=======================

Symfony Form Type

1.0.0(2y ago)012MITPHP

Since Feb 5Pushed 2y agoCompare

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

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

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

[](#symfony-dropzonetype)

Extends the SymfonyForm component. Adds the new form type DropzoneType Use DropzoneType in form with relation other entity "One Form contain 2 entities relation".

Example : form with "Item" entity and DropZoneType link with "Attachment" entity

This is custom version of :

Installing
----------

[](#installing)

`composer require ethsam/symfony-dropzone`

Add the dropzone library to your project in template

```

```

Usage
-----

[](#usage)

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

    // userFiles is OneToMany
    $builder->add('userFiles', DropzoneType::class, [
        'class' => File::class,
        'maxFiles' => 6,
        'uploadHandler'=>'uploadHandler',  // route name
        'removeHandler'=> 'removeHandler'// route name
   ]),
   ->add('arrayIdMedia', TextType::class, ['mapped' => false]); //hide this type after tests
}
```

Examples route uploadHandler/removeHandler
------------------------------------------

[](#examples-route-uploadhandlerremovehandler)

```
    /**
     * @Route("/uploadhandler", name="uploadHandler")
     */
    public function uploadhandler(Request $request, ImageUploader $uploader) {

        $dateNow = new \DateTime('now');
        $doc = $uploader->upload($request->files->get('file'));
        $file = new Attachment();
        $file->setCreatedAt($dateNow);
        $file->setUpdatedAt($dateNow);
        $file->setImageFile($doc);

        $this->entityManager->persist($file);
        $this->entityManager->flush();
        return new JsonResponse([ "id" => $file->getId() ]);
    }

    /**
     * @Route("/removeHandler/{id}", name="removeHandler")
     */
    public function removeHandler(Request $request, $id) {

        $file = $this->repoAttachment->findOneBy(['id' => $id]);
        $idFile = $file->getId();

        $this->entityManager->remove($file);
        $this->entityManager->flush();

        return new JsonResponse([ "id" => $idFile ]);
    }
```

Example get data convert to array and findby for persist
--------------------------------------------------------

[](#example-get-data-convert-to-array-and-findby-for-persist)

```
    public function addClassifield(Request $request, EntityManagerInterface $entityManager): Response
    {
        $item = new Item();
        $form = $this->createForm(AddPropertyType::class, $item);

        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $item = $form->getData();

            $arrayItemsMedia = explode(',',$form->get("arrayIdMedia")->getData());
            foreach ($arrayItemsMedia as $key => $value) {
                $mediaObject = $this->repoAttachment->findOneBy(['id' => intval($value)]);
                $item->addAttachment($mediaObject);
            }

            $entityManager->persist($item);
            $entityManager->flush();
        }

        return $this->render('dashboard/dashboard-add-property.html.twig', [
            'form' => $form->createView(),
        ]);

    }
```

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

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

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

825d ago

### Community

Maintainers

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

---

Top Contributors

[![pvlkns](https://avatars.githubusercontent.com/u/23255140?v=4)](https://github.com/pvlkns "pvlkns (2 commits)")[![ethsam](https://avatars.githubusercontent.com/u/27362741?v=4)](https://github.com/ethsam "ethsam (1 commits)")

### Embed Badge

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

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

###  Alternatives

[symfony/ux-twig-component

Twig components for Symfony

21814.8M161](/packages/symfony-ux-twig-component)[a2lix/auto-form-bundle

Automate form building

873.8M11](/packages/a2lix-auto-form-bundle)[iq2i/storia-bundle

UI Storia bundle

144.6k](/packages/iq2i-storia-bundle)

PHPackages © 2026

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