How can I receive data from POST request in my controller? I don\'t use twig.
public function newAction(Request $request)
{
//when I use
$content = $re
$request->request->get('content');
POST: $request->request->get('<propertyName>');
GET: $request->query->get('<propertyName>');
You can use for POST request :
$request->request->get('data');
For GET request:
$request->query->get('data');
For FILE queries:
$request->files.
And ask your questions How to save image?
, you must create uploads -> excels
:
$dir = $this->get('kernel')->getRootDir() . '/../web/uploads/images/';
$name = uniqid() . '.jpeg';
foreach ($request->files as $uploadedFile) {
$uploadedFile->move($dir, $name);
}
$file = $this->get('kernel')->getRootDir() . "/../web/uploads/images/" . $name;
if (file_exists($file)) {
echo "Successfully saved";
}
Dump all data from request to find possible problem with: $request->request->all();