Hi guys;
Can i receive input elements from multipart-form data with slim 3 ?
Tanks
Hi guys;
Can i receive input elements from multipart-form data with slim 3 ?
Tanks
I found a solution; it´s work only with POST
public function updateUser(Request $request, Response $response, array $args): Response
{
$name = trim(filter_input(INPUT_POST, 'name', FILTER_DEFAULT));
$email = trim(filter_input(INPUT_POST, 'email', FILTER_DEFAULT));
$token = trim(filter_input(INPUT_POST, 'token', FILTER_DEFAULT));
$language = trim(filter_input(INPUT_POST, 'language', FILTER_DEFAULT));
if (empty($_FILES)) {
//log
} else {
$arquivo_tmp = $_FILES['avatar']['tmp_name'];
$nome = $_FILES['avatar']['name'];
}
Have you tried to use the getParsedBody
method?
$formData = $request->getParsedBody();
Yes; i have a lot of endpoints with getParsedBody but if i have one or more files it´s doesn´t works. There´s any problem with multi part form with files.
But i found a solution; thanks.
Have you tried to use $files = $request->getUploadedFiles();
to read the files from the request object?
Yes, but doesn´t work in Slim 3. I need input text elements AND files.