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

        <i id='AkKsM'><tr id='AkKsM'><dt id='AkKsM'><q id='AkKsM'><span id='AkKsM'><b id='AkKsM'><form id='AkKsM'><ins id='AkKsM'></ins><ul id='AkKsM'></ul><sub id='AkKsM'></sub></form><legend id='AkKsM'></legend><bdo id='AkKsM'><pre id='AkKsM'><center id='AkKsM'></center></pre></bdo></b><th id='AkKsM'></th></span></q></dt></tr></i><div id='AkKsM'><tfoot id='AkKsM'></tfoot><dl id='AkKsM'><fieldset id='AkKsM'></fieldset></dl></div>
      1. <legend id='AkKsM'><style id='AkKsM'><dir id='AkKsM'><q id='AkKsM'></q></dir></style></legend>

      2. <tfoot id='AkKsM'></tfoot>
      3. <small id='AkKsM'></small><noframes id='AkKsM'>

        我如何判断是否有人伪造文件类型?(PHP)

        时间:2023-12-01

          <i id='13Cwf'><tr id='13Cwf'><dt id='13Cwf'><q id='13Cwf'><span id='13Cwf'><b id='13Cwf'><form id='13Cwf'><ins id='13Cwf'></ins><ul id='13Cwf'></ul><sub id='13Cwf'></sub></form><legend id='13Cwf'></legend><bdo id='13Cwf'><pre id='13Cwf'><center id='13Cwf'></center></pre></bdo></b><th id='13Cwf'></th></span></q></dt></tr></i><div id='13Cwf'><tfoot id='13Cwf'></tfoot><dl id='13Cwf'><fieldset id='13Cwf'></fieldset></dl></div>

          <legend id='13Cwf'><style id='13Cwf'><dir id='13Cwf'><q id='13Cwf'></q></dir></style></legend>
          1. <small id='13Cwf'></small><noframes id='13Cwf'>

          2. <tfoot id='13Cwf'></tfoot>
            • <bdo id='13Cwf'></bdo><ul id='13Cwf'></ul>
                    <tbody id='13Cwf'></tbody>
                  本文介绍了我如何判断是否有人伪造文件类型?(PHP)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在编写一些程序,允许用户在网络服务器上存储文档和图片,以便以后存储和检索.当用户将文件上传到我的服务器时,PHP 会根据扩展名告诉我它是什么文件类型.但是,我担心用户可以将 zip 文件重命名为 somezipfile.png 并存储它,从而在我的服务器上保留一个 zip 文件.有什么合理的方法可以打开上传的文件并检查"它是否真的属于上述文件类型?

                  I'm programming something that allows users to store documents and pictures on a webserver, to be stored and retrieved later. When users upload files to my server, PHP tells me what filetype it is based on the extension. However, I'm afraid that users could rename a zip file as somezipfile.png and store it, thus keeping a zip file on my server. Is there any reasonable way to open an uploaded file and "check" to see if it truly is of the said filetype?

                  推荐答案

                  幻数.如果您可以读取二进制文件的前几个字节,您就可以知道它是什么类型的文件.

                  Magic number. If you can read first few bytes of a binary file you can know what kind of file it is.

                  这篇关于我如何判断是否有人伪造文件类型?(PHP)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:上传文件 PHP 时生成唯一文件名的最佳方法 下一篇:Laravel 文件不存在 - 文件上传

                  相关文章

                • <i id='ncvao'><tr id='ncvao'><dt id='ncvao'><q id='ncvao'><span id='ncvao'><b id='ncvao'><form id='ncvao'><ins id='ncvao'></ins><ul id='ncvao'></ul><sub id='ncvao'></sub></form><legend id='ncvao'></legend><bdo id='ncvao'><pre id='ncvao'><center id='ncvao'></center></pre></bdo></b><th id='ncvao'></th></span></q></dt></tr></i><div id='ncvao'><tfoot id='ncvao'></tfoot><dl id='ncvao'><fieldset id='ncvao'></fieldset></dl></div>
                • <legend id='ncvao'><style id='ncvao'><dir id='ncvao'><q id='ncvao'></q></dir></style></legend>

                      <bdo id='ncvao'></bdo><ul id='ncvao'></ul>
                  1. <tfoot id='ncvao'></tfoot>

                  2. <small id='ncvao'></small><noframes id='ncvao'>