N
N
nepster-web2015-11-11 22:35:41
PHP
nepster-web, 2015-11-11 22:35:41

Is it possible to send FormData using PUT method?

I work with Rest Api, and I need to send data using the PUT method, I use my JS API inside which FormData is used.

When I tried to send data using the PUT method, I got the following on the server:

Array
(
    [-----------------------------568523915322479515696938189
Content-Disposition:_form-data;_name] => "alias"

Алиас
-----------------------------568523915322479515696938189
Content-Disposition: form-data; name="name"

Название
-----------------------------568523915322479515696938189
Content-Disposition: form-data; name="submit"

submit
-----------------------------568523915322479515696938189--

)


Files are the same problem, and the FILES array is empty. If you send data to native jquery, then everything is fine.

Question 2 at once:
- how to send FormData to the server using the PUT method?
- Is it fashionable to send a file to a PUT request?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GM2mars, 2015-11-12
@GM2mars

If on the server the request is processed by php, then put the data like this:

parse_str(file_get_contents('php://input'), $request);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question