1

I need to forward a POST request in Symfony but before forwarding I need to convert an image from base64 to $_FILES parameter. How can I do this?

1 Answer 1

3

Are you submitting a form before you forward? If you are you can do:

if($form->isSubmitted() && $form->isValid){ //Do whatever work you need to in here like uploading the image // before the forward return $this->forward('@Bundle:action', array( 'request' => $request)); } 

As for converting your file take a look at the answer to this question. It should do the trick. Hope this helps!

Sign up to request clarification or add additional context in comments.

2 Comments

The idea is to add the uploaded (converted from base64) image to the $_FILES before forward. Or to the $request->files because in the forwarded controller I need it as if it was submitted via POST from the browser.
So you should then be able to do $request->files->add($arrayWithImageInIt)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.