PHPackages                             sopinet/upload-magic-bundle - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. sopinet/upload-magic-bundle

ActiveSymfony-bundle[File &amp; Storage](/categories/file-storage)

sopinet/upload-magic-bundle
===========================

Symfony2 Bundle - Easy integration for DropzoneJS and OneupUploaderBundle

1.1.x-dev(10y ago)2342[3 issues](https://github.com/sopinet/upload-magic-bundle/issues)GPL2JavaScriptPHP &gt;=5.4.0

Since Feb 11Pushed 10y ago7 watchersCompare

[ Source](https://github.com/sopinet/upload-magic-bundle)[ Packagist](https://packagist.org/packages/sopinet/upload-magic-bundle)[ RSS](/packages/sopinet-upload-magic-bundle/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (1)Versions (5)Used By (0)

DEPRECATED, USE:
===============================================================

[](#deprecated-use-httpsgithubcomsopinetuploadfilesbundle)

upload-magic-bundle
===================

[](#upload-magic-bundle)

Symfony2 Bundle - Easy integration for DropzoneJS and OneupUploaderBundle

Prerequisites
-------------

[](#prerequisites)

This bundle is tested using Symfony2 versions 2.3+.

Installation:
-------------

[](#installation)

### Step 1: Add Bundle

[](#step-1-add-bundle)

1. Add to composer:

```
"sopinet/upload-magic-bundle": "dev-master"
```

2. Add to AppKernel:

```
new Oneup\UploaderBundle\OneupUploaderBundle(),
new Sopinet\Bundle\UploadMagicBundle\SopinetUploadMagicBundle(),
```

3. Add routing for delete

```
upload:
    resource: "@SopinetUploadMagicBundle/Controller/UploadController.php"
    type:     annotation

```

### Step 2: Configure OneupUploaderBundle

[](#step-2-configure-oneupuploaderbundle)

1. Add configuration (config.yml) any like:

```
oneup_uploader:
    mappings:
        gallery:
            frontend: dropzone
```

2. Configure routing

```
oneup_uploader:
    resource: .
    type: uploader
```

2. More options from OneupUploaderBundle, but upload-magic-bundle only support dropzone frontend method.

### Step 3: Define your Entity

[](#step-3-define-your-entity)

1. You can use UploadMagic trait, so:

```
namespace yourBundle\BaseBundle\Entity;

use ...

/**
 * @ORM\Entity
 * @ORM\Table(name="file")
 * @DoctrineAssert\UniqueEntity("id")
 */
class File
{

	use \Sopinet\Bundle\UploadMagicBundle\Model\UploadMagic;
	...
}
```

2. You can add relation and another attributes to your entity:

```
  ...
	/**
	 * @ORM\ManyToOne(targetEntity="Category", inversedBy="files")
	 * @ORM\JoinColumn(name="category_id", referencedColumnName="id")
	 */
	protected $category;
	...
```

### Step 4: Add your form

[](#step-4-add-your-form)

1. Add CSS

```
{% include 'SopinetUploadMagicBundle:Upload:simple_css.html.twig' %}
```

2. Add form

```
								{% include 'SopinetUploadMagicBundle:Upload:simple.html.twig'
								  	with {
								  		'name': 'demo',
								  		'type': 'gallery',
								  		'id': 0,
								  		'entity': 'myBundle_BaseBundle_File',
								  		'param1': 'title',
                			'value1': 'A title for...',
                			'param2': 'myBundle_BaseBundle_Category',
                			'value2': guild.id,
                			'icon': 'fa fa-plus-circle'
										}
								  %}
```

In param1 i use "title", and Listener will do "setTitle".

With param2 it use an entity, and it will do findbyoneid and "set" again.

More documentation about params form is coming... ;)

3. Add js, one time

```
{% include 'SopinetUploadMagicBundle:Upload:simple_js.html.twig' %}

```

If you have errors about load time, you can use:

```
{% include 'SopinetUploadMagicBundle:Upload:simple_js.timeout.html.twig' %}

```

4. Add blockjs, for each form

```
	{% include 'SopinetUploadMagicBundle:Upload:simple_blockjs.html.twig'
		with {
		  'name': 'demo',
		  'type': 'gallery',
		  'files': files_already_saved_array,
		  'limit': 1,
		  'entity': 'myBundle_BaseBundle_File'
		  # Optional
		  'preview': true
		}
	%}

```

More JS, trigger
----------------

[](#more-js-trigger)

What file is uploading or file is removed, you can capture this event in JQuery and do anything.

### Events

[](#events)

```
$( "body" ).on( "removedFile", function( event, data) {
  // data, "ok" or "ko"
});

$("body").on("uploadedFile", function(event, data) {
  // data, "ok"
});
```

### Sample

[](#sample)

```
$( "body" ).on( "removedFile", function( event, data) {
	if (data == "ok") {
		$.gritter.add({
			title: ' Acción realizada con éxito',
			text: 'Has eliminado un fichero',
			sticky: false,
			time: '',
			class_name: 'gritter-success'
		});
	} else {
		$.gritter.add({
			title: ' Ha ocurrido un error',
			text: 'No se ha podido eliminar el fichero',
			sticky: false,
			time: '',
			class_name: 'gritter-danger'
		});
	}
});
$("body").on("uploadedFile", function(event, data) {
	$.gritter.add({
		title: ' Acción realizada con éxito',
		text: 'Has guardado un fichero',
		sticky: false,
		time: '',
		class_name: 'gritter-success'
	});
});
```

TODO
====

[](#todo)

1. Better documentation about params to Form
2. More is coming...

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.3% 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

Every ~0 days

Total

2

Last Release

3746d ago

### Community

Maintainers

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

---

Top Contributors

[![hidabe](https://avatars.githubusercontent.com/u/50526?v=4)](https://github.com/hidabe "hidabe (10 commits)")[![alejandro-arrabal](https://avatars.githubusercontent.com/u/7114123?v=4)](https://github.com/alejandro-arrabal "alejandro-arrabal (1 commits)")[![jmartos89](https://avatars.githubusercontent.com/u/2951863?v=4)](https://github.com/jmartos89 "jmartos89 (1 commits)")

---

Tags

bundleSymfony2uploaddropzone.jsoneupuploader

### Embed Badge

![Health badge](/badges/sopinet-upload-magic-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/sopinet-upload-magic-bundle/health.svg)](https://phpackages.com/packages/sopinet-upload-magic-bundle)
```

###  Alternatives

[presta/image-bundle

PrestaImageBundle is a Symfony bundle providing tools to resize uploaded and remote images before sending them through a classic form.

24155.9k](/packages/presta-image-bundle)

PHPackages © 2026

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