• <tfoot id='wlhkS'></tfoot>

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

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

        使用 PHP 上传 mp4 文件

        Uploading mp4 files using PHP(使用 PHP 上传 mp4 文件)
        • <legend id='0BUco'><style id='0BUco'><dir id='0BUco'><q id='0BUco'></q></dir></style></legend>

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

            <small id='0BUco'></small><noframes id='0BUco'>

              <bdo id='0BUco'></bdo><ul id='0BUco'></ul>
              <tfoot id='0BUco'></tfoot>

                    <tbody id='0BUco'></tbody>
                  本文介绍了使用 PHP 上传 mp4 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我可以使用 PHP 上传脚本上传 png/jpegs/图像,但无法在我的本地服务器上上传 mp4 文件.脚本没有显示任何错误.

                  I am able to upload png/jpegs/images using PHP upload script but am not able to upload mp4 files on my local server. Script is not displaying any error.

                  <?php
                  ini_set('display_startup_errors',1);
                  ini_set('display_errors',1);
                  error_reporting(-1);
                  //include authentication here/ Gmail is good solution for now
                  //check if it's not allowing any other extenstion other than MP4
                  $allowedExts = array("gif", "jpeg", "jpg", "png","mp4");
                  $temp = explode(".", $_FILES["file"]["name"]);
                  print_r($_FILES["file"]["type"]);
                  $extension = end($temp);
                  if ((($_FILES["file"]["type"] == "image/gif")
                  || ($_FILES["file"]["type"] == "image/jpeg")
                  || ($_FILES["file"]["type"] == "image/jpg")
                  || ($_FILES["file"]["type"] == "image/pjpeg")
                  || ($_FILES["file"]["type"] == "image/x-png")
                  || ($_FILES["file"]["type"] == "image/png"))
                  || ($_FILES["file"]["type"] == "video/mp4"))
                  && ($_FILES["file"]["size"] < 200000)
                  && in_array($extension, $allowedExts)) {
                    if ($_FILES["file"]["error"] > 0) {
                      echo "Return Code: " . $_FILES["file"]["error"] . "<br>";
                    } else {
                      echo "Upload: " . $_FILES["file"]["name"] . "<br>";
                      echo "Type: " . $_FILES["file"]["type"] . "<br>";
                      echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
                      echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br>";
                      if (file_exists("uploads/" . $_FILES["file"]["name"])) {
                        echo $_FILES["file"]["name"] . " already exists. ";
                      } else {
                        move_uploaded_file($_FILES["file"]["tmp_name"],
                        "uploads/" . $_FILES["file"]["name"]);
                        echo "Stored in: " . "uploads/" . $_FILES["file"]["name"];
                      }
                    }
                  } else {
                    echo "Invalid file";
                  }
                  ?>
                  enter code here
                  changed my code to this
                  
                  
                   <?php
                      ini_set('display_startup_errors',1);
                      ini_set('display_errors',1);
                      error_reporting(-1);
                      //include authentication here/ Gmail is good solution for now
                      //check if it's not allowing any other extenstion other than MP4
                      $allowedExts = array("gif", "jpeg", "jpg", "png","mp4");
                      $temp = explode(".", $_FILES["file"]["name"]);
                      print_r($_FILES["file"]["type"]);
                      $extension = end($temp);
                      if (($_FILES["file"]["size"] < 200000)) {
                        if ($_FILES["file"]["error"] > 0) {
                          echo "Return Code: " . $_FILES["file"]["error"] . "<br>";
                        } else {
                          echo "Upload: " . $_FILES["file"]["name"] . "<br>";
                          echo "Type: " . $_FILES["file"]["type"] . "<br>";
                          echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
                          echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br>";
                          if (file_exists("uploads/" . $_FILES["file"]["name"])) {
                            echo $_FILES["file"]["name"] . " already exists. ";
                          } else {
                            move_uploaded_file($_FILES["file"]["tmp_name"],
                            "uploads/" . $_FILES["file"]["name"]);
                            echo "Stored in: " . "uploads/" . $_FILES["file"]["name"];
                          }
                        }
                      } else {
                        echo "Invalid file";
                      }
                      ?>
                  

                  还是一样的错误

                  视频/mp4无效文件

                  推荐答案

                  如果你的代码没有任何错误,请确保增加post_max_size AND load_max_filesize AND memory_limit

                  If your code does not have any errors, please make sure to increase post_max_size AND load_max_filesize AND memory_limit

                  • post_max_size
                  • upload_max_filesize
                  • memory_limit

                  参见处理文件上传:常见问题 其中详细解释了这一点以及如何计算这些值.

                  See Handling file uploads: Common Pitfals which explains this in detail and how to calculate the values.

                  这篇关于使用 PHP 上传 mp4 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

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

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

                        <tbody id='RuQ0Z'></tbody>
                    1. <legend id='RuQ0Z'><style id='RuQ0Z'><dir id='RuQ0Z'><q id='RuQ0Z'></q></dir></style></legend>

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