• <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 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  PHP Upload File Validation(PHP 上传文件验证)
                  PHP Error - Uploading a file(PHP 错误 - 上传文件)
                  How can I write tests for file upload in PHP?(如何在 PHP 中编写文件上传测试?)
                  php resizing image on upload rotates the image when i don#39;t want it to(php在上传时调整图像大小会在我不想要它时旋转图像)
                  How to send additional data using PLupload?(如何使用 PLupload 发送附加数据?)
                  change button text in js/ajax after mp4 =gt;mp3 conversion in php(在 php 中的 mp4 =gt;mp3 转换后更改 js/ajax 中的按钮文本)

                  <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>