Download Symfony REST file over PUT method

I have a REST service where I want to update a file via PUT. When I use POST, I used the following to get the downloaded file:

/**
 * @var Request $request
 */
$request->files->get('file');

How to upload a downloaded file as a PUT in the Symfony Framework?

+4
source share
1 answer

When you receive a POST request, you receive a form represented by one or more fields, and these fields include any files (possibly multiple files). Content-Type multipart/form-data.

, . GET, . , JPG PUT, Content-Type image/jpeg. , , PUT.

$request->getContent() . , PUT , , POST.

- PUT, , . , PUT /api/record/123/attachment?filename=example.pdf. , ( ), ID (123) , .

0

Source: https://habr.com/ru/post/1545821/


All Articles