SonataAdminBundle file upload: Error
"any infos on this topic"
Have you seen http://symfony.com/doc/current/cookbook/form/form_collections.html ?
You should embed image form into the parent form. For instance,
->add('myImage','collection',array('type'=>new MyImageType()))
Instead of putting multiple image1, image2,... make another form class, eg. MyImageType() and add it as a collection type in to an existing form.
Work in that direction, good luck.
Symfony Sonata AJAX image multi-upload
So I endedup using Valumns Ajax multi uploader: http://valums.com/ajax-upload/
I tried to customize the Sonata Admin Page but this proved a bit difficult, Instead I simply created a route / controller / view specifically for uploading batch images. It seems to be working great!
Error uploading file using Sonata Admin and Doctirne
The problem is that you never call the upload
method of your entity.
Add the following methods to your admin class (sonata) :
/**
* Handles file upload on create.
*
* @param object $created The newly created entity
*/
public function prePersist($created)
{
$created->upload();
}
/**
* Handles file upload on update.
*
* @param object $updated The updated entity
*/
public function preUpdate($updated)
{
$updated->upload();
}
And it should works.
This will call the upload
method of your entity before persist/update it.
See the corresponding part of the Sonata File upload recipe.
Related Topics
Navigate Back with PHP Form Submission
How to Capture Search Term from Google Search
JSON: PHP to JavaScript Safe or Not
Php, MySQL - Too Many Connections to Database Error
Best Way to Check for Positive Integer (Php)
Sending Bcc Emails Using a Smtp Server
How to Strip Out the Domain Name from a Url in PHP
Difference Between Require and Install VS Create-Project in Composer
Format Output of $Simplexml->Asxml();
How to Display Two Table Columns Per Row in PHP Loop
How to Add Commas to Numbers in PHP
Safe Alternatives to PHP Globals (Good Coding Practices)
PHP Switch Case More Than One Value in the Case
PHP Array Printing Using a Loop
How to Check If a Longitude/Latitude Point Is Within a Range of Coordinates