Using PUT method in HTML form

MyTitle picture MyTitle · Nov 8, 2011 · Viewed 194.7k times · Source

Can I use a PUT method in an HTML form to send data from the form to a server?

Answer

phihag picture phihag · Nov 8, 2011

According to the HTML standard, you can not. The only valid values for the method attribute are get and post, corresponding to the GET and POST HTTP methods. <form method="put"> is invalid HTML and will be treated like <form>, i.e. send a GET request.

Instead, many frameworks simply use a POST parameter to tunnel the HTTP method:

<form method="post" ...>
  <input type="hidden" name="_method" value="put" />
...

Of course, this requires server-side unwrapping.