<legend id='6y7Z0'><style id='6y7Z0'><dir id='6y7Z0'><q id='6y7Z0'></q></dir></style></legend>
      <tfoot id='6y7Z0'></tfoot>

      <small id='6y7Z0'></small><noframes id='6y7Z0'>

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

        <bdo id='6y7Z0'></bdo><ul id='6y7Z0'></ul>

        PHP 文件上传不读取 $_FILES['image']

        时间:2023-05-21

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

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

                <tfoot id='EGoEm'></tfoot>
                <legend id='EGoEm'><style id='EGoEm'><dir id='EGoEm'><q id='EGoEm'></q></dir></style></legend>
                  <bdo id='EGoEm'></bdo><ul id='EGoEm'></ul>
                • 本文介绍了PHP 文件上传不读取 $_FILES['image']的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我有这个输入类型

                    <input class="btn btn-success" type="file" name="profile_image" style="margin-top:10px; margin-left:20px;"></input>
                  

                  用户将从这里添加图像文件,以及上传文件的 PHP 代码

                  user will add the image file from here, and the PHP code to upload the file

                  if(isset($_FILES['profile_image']))
                              {
                                  $image_type = $this->getImageType($_FILES['profile_image']);
                  
                                  if($image_type == 'image')
                                  {
                                      $extension = pathinfo($_FILES['profile_image']['name'], PATHINFO_EXTENSION);
                                      $filename = '123_'.uniqid().'.'.$extension;
                                      move_uploaded_file($_FILES['profile_image']['tmp_name'], '../functions/images/images/'.$filename);
                                  }
                              }
                  else
                              {
                                  $filename = 'default_profile_image.jpg';
                              }
                  

                  getImageType

                  public function getImageType($file)
                      {
                          $imageMime = getimagesize($file['tmp_name']);
                          $type = explode('/', $imageMime['mime']);
                          return $type[0];
                      }
                  

                  但它不读取 $_FILES['profile_image'] 而是移动到其他部分.为什么它不读取 $_FILES ?有什么遗漏吗?

                  but it does not read $_FILES['profile_image'] and rather moves to else part. why does it not read $_FILES ? is there anything missing?

                  推荐答案

                  在表单标签中添加这段代码
                  enctype="multipart/form-data"

                  add this code in form tag
                  enctype="multipart/form-data"

                  <form action="upload.php" method="post" enctype="multipart/form-data">
                  

                  这篇关于PHP 文件上传不读取 $_FILES['image']的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:PHP:UPLOAD_ERR_INI_SIZE 有什么意义? 下一篇:使用 PHP 重命名上传的文件但保留扩展名

                  相关文章

                  最新文章

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

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

                        <bdo id='q62Nz'></bdo><ul id='q62Nz'></ul>