I have:
routing.ymlservices.ymlblobuploader.phpWhen I do
I get
I've searched and searched for examples of POST controllers and haven't found one.
Help, please!
routing.yml
Code:
tig_blobuploader_blobuploader: path: /blobuploader defaults: { _controller: tig.blobuploader.controller.blobuploader::handle_request } methods: [POST]
Code:
services:... tig.blobuploader.controller.blobuploader: class: tig\blobuploader\controller\blobuploader arguments: - '@user' - '@request' - '%core.root_path%' - '%core.php_ext%'
Code:
<?phpnamespace tig\blobuploader\controller;use Symfony\Component\HttpFoundation\Response;class blobuploader{ protected $user; protected $request; protected $root_path; protected $php_ext; public function __construct( user $user, request $request, $root_path, $php_ext ) { $this->user = $user; $this->request = $request; $this->root_path = $root_path; $this->php_ext = $php_ext; } public function handle_request () { ... }
curl -X POST -F "image=@images/spacer.gif" http://localhost/blobuploader
I get
Code:
<br /><b>Fatal error</b>: Uncaught TypeError: Symfony\Component\HttpKernel\Event\FilterControllerEvent::__construct(): Argument #2 ($controller) must be of type callable, array given, called in /var/www/html/phpbb/vendor/symfony/http-kernel/HttpKernel.php on line 138 and defined in /var/www/html/phpbb/vendor/symfony/http-kernel/Event/FilterControllerEvent.php:32Stack trace:#0 /var/www/html/phpbb/vendor/symfony/http-kernel/HttpKernel.php(138): Symfony\Component\HttpKernel\Event\FilterControllerEvent->__construct()#1 /var/www/html/phpbb/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw()#2 /var/www/html/phpbb/app.php(35): Symfony\Component\HttpKernel\HttpKernel->handle()#3 {main} thrown in <b>/var/www/html/phpbb/vendor/symfony/http-kernel/Event/FilterControllerEvent.php</b> on line <b>32</b><br />
Help, please!
Statistics: Posted by tig_ — Fri Jan 10, 2025 7:03 pm