1. Go to this page and download the library: Download evolutasrl/dropzone-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
evolutasrl / dropzone-bundle example snippets
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Evoluta\DropzoneBundle\EvolutaDropzoneBundle(),
// ...
);
}
###Step 3: Configure DropzoneBundle
The next step is to configure the bundle to work with the specific needs of your application.
Add the following configuration to your ``parameters.yml`` file.
dropzone_endpoint: //s3-eu-west-1.amazonaws.com/
dropzone_accessKey: <aws_accesskey>
dropzone_secret: <aws_secret>
dropzone_bucket: <aws_bucket>
You can override configurations from ``parameters.yml`` in your type usage.
Add the following configuration to your ``config.yml`` file.
evoluta_dropzone:
endpoint: "%dropzone_endpoint%"
accessKey: "%dropzone_accessKey%"
secret: "%dropzone_secret%"
bucket: "%dropzone_bucket%"
###Step 4: Add twig configuration
Add in your config.yml file the follow line
- 'EvolutaDropzoneBundle:Form:fields.html.twig'
Your config twig area will be like that
twig:
debug: "%kernel.debug%"
strict_variables: "%kernel.debug%"
globals:
_guardian_company: "@guardian.company.identity_factory"
form_themes:
- bootstrap_3_layout.html.twig
- 'EvolutaDropzoneBundle:Form:fields.html.twig'
###Step 5: Javascript and css
Todo: describe assets dump and declare in main template.
Usage - upload single
------------
With this bundle, is available for you a new form field type called ``dropzoneS3File``.
This field type extends the symfony default url field type.
class DropzoneController extends Controller
{
public function testAction(Request $request)
{
// ...
$form = $this->createFormBuilder()
->add(
'task1',
'dropzoneS3File'
)
->add(
'task2',
'dropzoneS3File',
array(
'acceptedFiles' => 'image/*',
'directory' => 'images/sub1/sub2'
)
)
->getForm();
// ...
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.