加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

PHP文件上传. POST与PUT?

发布时间:2020-12-13 13:29:41 所属栏目:PHP教程 来源:网络整理
导读:我正在建立一个网站,人们可以上传文件大小限制为1GB的视频. Firefox 3.6和Chrome 11是我打算支持的唯一浏览器.对于大文件,使用 PUT方法超过 POST方法的文件上传是否有任何优点/缺点.不同的http方法如何影响网站的性能? 我对此事没有个人意见,但这里有一些资
我正在建立一个网站,人们可以上传文件大小限制为1GB的视频. Firefox> 3.6和Chrome> 11是我打算支持的唯一浏览器.对于大文件,使用 PUT方法超过 POST方法的文件上传是否有任何优点/缺点.不同的http方法如何影响网站的性能?
我对此事没有个人意见,但这里有一些资源可以帮到你:

> http://www.elharo.com/blog/software-development/web-development/2005/12/08/post-vs-put/

PUT is a much more limited operation that never does anything more than PUT one page at a specified URL. It is idempotent,which is a fancy way of saying that doing it twice is the same as doing it once. Both PUT and POST can be used to create new pages. However PUT should be used when the client specifies the location for the page. PUT is normally the right protocol for a web editor like DreamWeaver or BBEdit. POST is used when the client gives sends the page to the the server,and the server then tells the client where it put it. POST is normally the right protocol for a blog editor like TypePad or anything that inputs into a content management system. In SQL analogy,POST is an INSERT with an automatically generated primary key,and PUT is an INSERT that specifies the primary key in the INSERT statement.

> PUT vs. POST for files upload RESTful api to be built using Zend Framework
> PUT vs POST in REST
> http://upload.thinfile.com/docs/put.php

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.

根据我对阅读上述链接的理解,略读主要部分告诉我,PUT方法主要用于原始数据,没有组织内容,没有编码或拆分成多部分消息.

PUT似乎是Socket to Socket连接,例如Telnet<>邮件服务器,因此使用POST可以提供更多的基础框架来在一个批处理中上传多个文件,因为你已经在我的POST方法中构建了边界

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读