Tuesday 13 December 2011

HTTP PUT vs POST для загрузки файлов, что лучше?

По инфе с stackoverflow:

The PUT method, though not as widely used as the POST method is perhaps the more efficient way of uploading files to a server. This is because in a POST upload the files neede to be combined together into a multipart message and this message has to be decoded at the server. In contrast, the PUT method allows you to simply write the contents of the file to the socket connection that is established with the server.

Информация из мана cURL подтверждает, что для загрузки файлов PUT - лучший вариант:
5. PUT

The perhaps best way to upload data to a HTTP server is to use PUT. Then
again, this of course requires that someone put a program or script on the
server end that knows how to receive a HTTP PUT stream.

Put a file to a HTTP server with curl:

curl --upload-file uploadfile

No comments :

Post a Comment

Note: only a member of this blog may post a comment.