douxiegan6468 2018-11-03 06:34
浏览 81

PHP:在接受文件上传主体之前检查请求标头

I'm sure someone will find a duplicate sometime later. But for now, here's my question:

I want to handle file uploads in this way:

  • Before user agent uploads the HTTP body, I want to receive the header first and determine whether the current CDN server is capable of storing the uploaded file.

  • If it cannot, a 307 redirect response is returned, telling the UA to try the next server in line (cdn0.example.com -> cdn1.example.com -> cdn2.example.com -> cdn3.exmaple.com -> etc...), until a server receives the file body successfully, or in the unlikely case, return a 500 status code.

Obviously, I don't want to store the request body too soon, so the POST method is probably not what I want. So can the PUT method work for me? And how?

Side question: Is "507 Insufficient Storage" a WebDAV-specific status code, or it's a general status code I can use elsewhere?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
    • ¥20 西门子S7-Graph,S7-300,梯形图
    • ¥50 用易语言http 访问不了网页
    • ¥50 safari浏览器fetch提交数据后数据丢失问题
    • ¥15 matlab不知道怎么改,求解答!!
    • ¥15 永磁直线电机的电流环pi调不出来
    • ¥15 用stata实现聚类的代码
    • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
    • ¥20 docker里部署springboot项目,访问不到扬声器
    • ¥15 netty整合springboot之后自动重连失效