search

Home  >  Q&A  >  body text

php - Post upload file, content-length does not match the actual obtained size

form form upload file,

Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip, deflate, br
Accept-Language:zh-CN,zh;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Content-Length:1495
Content-Type:multipart/form-data; boundary=----WebKitFormBoundaryA0iAa0dqm6ZugY1G
Host:127.0.0.1:8899
Origin:http://127.0.0.1:8899
Referer:http://127.0.0.1:8899/file/file.html
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36

But the body is encoded data

------WebKitFormBoundaryA0iAa0dqm6ZugY1G
Content-Disposition: form-data; name="file"; filename="2.jpg"
Content-Type: image/jpeg


------WebKitFormBoundaryA0iAa0dqm6ZugY1G
Content-Disposition: form-data; name="submit"

Submit
------WebKitFormBoundaryA0iAa0dqm6ZugY1G--

Content-Length does not match the actual body length, so if I upload a large file, such as 5M, and I want to read 1M in a loop on the server side, what should I do?

天蓬老师天蓬老师2746 days ago811

reply all(1)I'll reply

  • 滿天的星座

    滿天的星座2017-05-18 10:47:25

    Content-Length is the calculation of HTTP transmission parameters, not just your files. If you want to loop, you should process it according to the file size you actually receive.

    reply
    0
  • Cancelreply