久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

        <small id='sWzyr'></small><noframes id='sWzyr'>

          <bdo id='sWzyr'></bdo><ul id='sWzyr'></ul>
        <legend id='sWzyr'><style id='sWzyr'><dir id='sWzyr'><q id='sWzyr'></q></dir></style></legend>

      1. <tfoot id='sWzyr'></tfoot>
        <i id='sWzyr'><tr id='sWzyr'><dt id='sWzyr'><q id='sWzyr'><span id='sWzyr'><b id='sWzyr'><form id='sWzyr'><ins id='sWzyr'></ins><ul id='sWzyr'></ul><sub id='sWzyr'></sub></form><legend id='sWzyr'></legend><bdo id='sWzyr'><pre id='sWzyr'><center id='sWzyr'></center></pre></bdo></b><th id='sWzyr'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='sWzyr'><tfoot id='sWzyr'></tfoot><dl id='sWzyr'><fieldset id='sWzyr'></fieldset></dl></div>
      2. 如何檢測用戶上傳的文件是否大于 post_max_size?

        How to detect if a user uploaded a file larger than post_max_size?(如何檢測用戶上傳的文件是否大于 post_max_size?)

          1. <tfoot id='VzSO0'></tfoot>
              <bdo id='VzSO0'></bdo><ul id='VzSO0'></ul>
              <legend id='VzSO0'><style id='VzSO0'><dir id='VzSO0'><q id='VzSO0'></q></dir></style></legend>

              1. <i id='VzSO0'><tr id='VzSO0'><dt id='VzSO0'><q id='VzSO0'><span id='VzSO0'><b id='VzSO0'><form id='VzSO0'><ins id='VzSO0'></ins><ul id='VzSO0'></ul><sub id='VzSO0'></sub></form><legend id='VzSO0'></legend><bdo id='VzSO0'><pre id='VzSO0'><center id='VzSO0'></center></pre></bdo></b><th id='VzSO0'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='VzSO0'><tfoot id='VzSO0'></tfoot><dl id='VzSO0'><fieldset id='VzSO0'></fieldset></dl></div>

                <small id='VzSO0'></small><noframes id='VzSO0'>

                  <tbody id='VzSO0'></tbody>
                • 本文介紹了如何檢測用戶上傳的文件是否大于 post_max_size?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我應(yīng)該如何以理智的方式處理超過 post_max_size 的 http 上傳?

                  How should I go about handling http uploads that exceeds the post_max_size in a sane manner?

                  在我的配置中 post_max_sizeupload_max_filesize 大幾 MB我遇到的問題是:
                  如果用戶上傳的文件超過 post_max_size

                  In my configuration post_max_size is a few MB larger than upload_max_filesize The problems I'm having are:
                  If a user uploads a file exceeding post_max_size

                  • _POST 數(shù)組為空
                  • _FILES 數(shù)組為空,當(dāng)然其中不存在任何錯誤代碼.
                  • 沒有其他信息可以通過這些方式訪問什么樣的表單帖子.

                  部分問題在于接收腳本根據(jù) POST 的內(nèi)容采取不同的操作.

                  Part of the problem is that the receiving script takes different actions depending on the contents of the POST.

                  我確實(shí)可以訪問 _SERVER 變量并且可以獲得關(guān)于發(fā)生了什么的線索,即 CONTENT_TYPECONTENT_LENGTHREQUEST_METHOD.然而,根據(jù)這些內(nèi)容進(jìn)行猜測似乎很成問題.

                  I do have access to the _SERVER variables and can get clues as to what happened, i.e. CONTENT_TYPE, CONTENT_LENGTH and REQUEST_METHOD. It does however seem very problematic to make guesses based on those contents.

                  MEMORY_LIMIT(設(shè)置為相關(guān)大小的 10 倍)和 Apaches LimitRequestBody(設(shè)置為無限制)沒有問題.

                  MEMORY_LIMIT (set to 10 times the relevant sizes) and Apaches LimitRequestBody (set to unlimited) are found to not be at fault.

                  就目前而言,我什至很難向用戶提供任何有意義的信息.

                  As it stands now I have a hard time even providing any meaningful messages to the user.

                  有什么辦法可以保留一些表單數(shù)據(jù),以便更好地了解發(fā)生了什么問題?我非常不愿意離開 php.

                  Is there any way to retain some form data to get better clues as to what has gone wrong? I'm very reluctant to move away from php.

                  推薦答案

                  對于不需要服務(wù)器端更改的簡單修復(fù),我將使用 HTML5 文件 API 在上傳之前檢查文件的大小.如果超過已知限制,則取消上傳.我相信這樣的事情會奏效:

                  For a simple fix that would require no server side changes, I would use the HTML5 File API to check the size of the file before uploading. If it exceeds the known limit, then cancel the upload. I believe something like this would work:

                  function on_submit()
                  {
                    if (document.getElementById("upload").files[0].size > 666)
                    {
                      alert("File is too big.");
                      return false;
                    }
                  
                    return true;
                  }
                  
                  <form onsubmit="return on_submit()">
                  <input id="upload" type="file" />
                  </form>
                  

                  顯然這只是一個例子的骨架,并不是每個瀏覽器都支持這個.但是使用它不會有什么壞處,因?yàn)樗梢砸赃@樣一種方式實(shí)現(xiàn),它可以優(yōu)雅地降級為舊瀏覽器的任何東西.

                  Obviously it's just a skeleton of an example, and not every browser supports this. But it wouldn't hurt to use this, as it could be implemented in such a way that it gracefully degrades into nothing for older browsers.

                  當(dāng)然,這并不能解決問題,但它至少可以讓您的一些用戶以最少的努力感到滿意.(他們甚至不必等待上傳失敗.)

                  Of course this doesn't solve the issue, but it will at least keep a number of your users happy with minimal effort required. (And they won't even have to wait for the upload to fail.)

                  --

                  順便說一句,檢查 $_SERVER['CONTENT_LENGTH'] 與帖子和文件數(shù)據(jù)的大小可能有助于檢測是否有問題.我認(rèn)為當(dāng)出現(xiàn)錯誤時它不會為零,而 $_POST$_FILES 都是空的.

                  As an aside, checking $_SERVER['CONTENT_LENGTH'] vs the size of the post and file data might help detect if something failed. I think it when there is an error it will be non zero, while the $_POST and $_FILES would both be empty.

                  這篇關(guān)于如何檢測用戶上傳的文件是否大于 post_max_size?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  enable SOAP on PHP(在 PHP 上啟用 SOAP)
                  Get received XML from PHP SOAP Server(從 PHP SOAP 服務(wù)器獲取接收到的 XML)
                  not a valid AllXsd value(不是有效的 AllXsd 值)
                  PHP SoapClient: SoapFault exception Could not connect to host(PHP SoapClient:SoapFault 異常無法連接到主機(jī))
                  Implementation of P_SHA1 algorithm in PHP(PHP中P_SHA1算法的實(shí)現(xiàn))
                  Sending a byte array from PHP to WCF(將字節(jié)數(shù)組從 PHP 發(fā)送到 WCF)

                      <legend id='WdJpf'><style id='WdJpf'><dir id='WdJpf'><q id='WdJpf'></q></dir></style></legend>
                    1. <i id='WdJpf'><tr id='WdJpf'><dt id='WdJpf'><q id='WdJpf'><span id='WdJpf'><b id='WdJpf'><form id='WdJpf'><ins id='WdJpf'></ins><ul id='WdJpf'></ul><sub id='WdJpf'></sub></form><legend id='WdJpf'></legend><bdo id='WdJpf'><pre id='WdJpf'><center id='WdJpf'></center></pre></bdo></b><th id='WdJpf'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='WdJpf'><tfoot id='WdJpf'></tfoot><dl id='WdJpf'><fieldset id='WdJpf'></fieldset></dl></div>
                    2. <small id='WdJpf'></small><noframes id='WdJpf'>

                        • <bdo id='WdJpf'></bdo><ul id='WdJpf'></ul>

                            <tbody id='WdJpf'></tbody>

                        • <tfoot id='WdJpf'></tfoot>
                          • 主站蜘蛛池模板: 美女天天操 | 国产精品综合色区在线观看 | 国产精品久久久久久久久免费樱桃 | 欧美日韩中文字幕在线 | www.久久 | ririsao久久精品一区 | 在线国产一区 | 欧美日韩亚洲一区 | 国产精品久久久久久久久久久久久 | 国产区精品 | 四虎影视免费在线 | 国产清纯白嫩初高生在线播放视频 | 有码在线 | 亚洲精品一区中文字幕乱码 | 日韩在线精品 | 亚洲综合中文字幕在线观看 | 国产精品久久国产精品99 | 国产精品不卡 | 精品一区二区三区在线观看国产 | 羞羞视频网站免费看 | 欧美一区二区三区 | 午夜伦理影院 | 日韩欧美精品一区 | 国产成人免费视频 | 天堂综合网久久 | 午夜一区二区三区在线观看 | 午夜影院黄 | 日韩欧美不卡 | 日本一区二区高清不卡 | 久久aⅴ乱码一区二区三区 91综合网 | 成人午夜激情 | 日韩欧美国产一区二区 | 久久一区二区三区免费 | 中文字幕精品一区二区三区精品 | 91精品国产91久久久久久吃药 | 久久精品 | a级免费视频 | 久草www| 日韩中文av在线 | 国产精品久久久久久久久久妇女 | 午夜精品久久久久久久久久久久 |