Recently I updated a symfony project from 3.2 to 3.3. I have an issue with a simple POST with a file. The file is not in the filebag of the http foundation object Request.
public function sendAction(Request $request){
dump($request->files);
dump($request->request);
dump($request->headers);
if (!$request->files->has("image")) {
throw new HttpException(Response::HTTP_BAD_REQUEST, 'no "image" field');
}
}
When I have a look at what it dumped, depending on the content-type of the request, I have different results :
If I use application/x-www-form-urlencoded
as header, I have these dump : https://pastebin.com/5HSCAgut (sorry for pastebin links, output is too long)
If i use multipart/form-data
as header, I have these dumps :
https://pastebin.com/tZdVKNgG
What's wrong with my script ? Am i missing a new feature or security check ?
Ok it was a stupid client error. I specified the header :
Content-type: multipart/form-data
but it should be
Content-type: multipart/form-data; boundary=-------------BOUNDARYUSEDINREQUEST--------------