Slim 4 file upload


I upgraded from slim 3 to 4. I made an rest-api for my frontend with angular 8. On the frontend I use
FormData to upload the image( For slim 3 this worked. In Slim 4 $request->getUploadedFiles() returns an empty array. I read and checked if there is a header “Content-Type:multipart/form-data”. The actual stream is in the request-payload. I surely do something wrong or forgot something. Has anyone some advice or tip?

thanks beforehand!

Coen Dunnink
The Netherlands


I also checked $_FILES and this is empty. The php.ini says " file uploads" = On

Hi, Have you tried looking at this section in the documentation regarding uploading?


I send a header application/json with the POST. This caused the image to be in the body. Thus no files($_FILES) were found.
Thanks for the help!

No problem. Glad it works :stuck_out_tongue_winking_eye: