• <legend id='SJbIx'><style id='SJbIx'><dir id='SJbIx'><q id='SJbIx'></q></dir></style></legend>
          <bdo id='SJbIx'></bdo><ul id='SJbIx'></ul>
        <tfoot id='SJbIx'></tfoot>

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

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

        PHP 图像大小小于 1mb

        时间:2023-12-01
        <tfoot id='9dJ0S'></tfoot>

        <small id='9dJ0S'></small><noframes id='9dJ0S'>

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

                  本文介绍了PHP 图像大小小于 1mb的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  目前,如果文件大小小于 1MB,我正在使用以下代码进行锻炼,但是因为以下代码来自 9lession 示例站点,它说要检查 1mb 的大小,但是如果我乘以 1024*2,它们就是在这里做的不是1mb而是2048kb

                  curretly I am using the following to workout if the file size is less than 1MB however as the following code was from 9lession example site it said to check the size for 1mb, but if I times 1024*2 which is what they are doing here it equals not 1mb but 2048kb

                  说它上传的大小不是kb,而是我理解的比特

                  saying that the size that it uploads is not in kb instead it from my understanding is bits

                  如果您感到困惑,我也是.我需要一种简单的方法来判断图像是否为 1mb 大小

                  if you're confused so am I. I need a simple way to tell if an image is 1mb size

                  if($size<(1024*1024))
                  

                  我上传的图片及其大小:

                  image that i uploaded and its size:

                  **尺寸:**10514

                  **Size:**10514

                  也是我不想在服务器级别设置它的原因,因为我们也想做视频.我们仍在努力达到我们接受的视频最大尺寸限制.

                  Also the reason I don't want to set it on a server level because we also want to do videos. We are still working our the max-size limit we will accept for videos.

                  推荐答案

                  1MB == 1048576 bytes

                  1MB == 1024 千字节

                  你的问题不清楚,但无论如何我都会即兴发挥.

                  1MB == 1048576 bytes

                  1MB == 1024 Kbytes

                  You question is not clear, but I will just improvise anyhow.

                  如果你想限制文件上传到 <仅 1MB!!然后,由于 $_FILES 数组将以字节为单位输出,您可以执行以下操作.

                  If you want to restrict file uploads to below < 1MB only!! then, since the $_FILES array, will output in bytes you can do the following.

                  if($_FILES['name']['size'] > 1048576){
                    //You can not upload this file
                  }
                  

                  或者你想从浏览器级别限制它,你可以在你的表单中添加一个属性

                  Or you want want to restrict it from browser-level, you can add an attribute to your form as

                  form method="POST" enctype="multipart/form-data">
                      <input type="hidden" name="MAX_FILE_SIZE" value="1048576" />
                      <input type="file" name="pictures" />
                      <input type="submit" value="upload" />
                  </form>
                  

                  当然,任何人都可以轻松更改第二个选项,并且永远不要使用.

                  Offcourse, the second option can be changed by anyone easily, and should never be used.

                  这篇关于PHP 图像大小小于 1mb的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在 CodeIgniter 中通过 jQuery AJAX 插入和移动多个图像 下一篇:使用 PHP 上传两个文件

                  相关文章

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

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