move_uploaded_file 因为 upload_max_filesize

move_uploaded_file because of the upload_max_filesize

编辑:问题是视频大小大于 upload_max_filesize 但我已经在 php.ini 中将其更改为 125M 但是当我使用 ini_get 回显该值时它说它仍然是 2M,尽管我改变了它不知道为什么以及如何改变它?我查看并尝试了 ini_set 但没有效果

我想上传视频,但 move_uploaded_file 正在返回 false。我确定文件目标是正确的。

这里是 PHP:

if(isset($_FILES['vid'])){
  if($_FILES['vid']['type'] == 'video/mp4'){

    $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1023456789";

    $randName = substr(str_shuffle($chars), 0 , 15);

    if(file_exists('data/users/videos/'.$randName.''.$_FILES['vid']['name'])){

    }// end of file exits
    else {
      $des = 'data/users/videos/'.$randName.''.$_FILES['vid']['name'];
      echo move_uploaded_file($_FILES['vid']['tmp_name'],
      $des);

    }
  }// end of checking the file type[video]
}

这是带有上传表单的页面:

<?php 
  include("./includes/upload_vid.php");
?>
<html>
 <head>
  <style>
  </style>
 </head>

 <body>
  <form method="post" enctype="multipart/form-data">
   <input type="file" name="vid">
   <input type="submit" name="uploadv" value="Upload">
  </form>

 </body>
</html>

带有表单的页面在 demosite 文件夹中。 目标文件夹位于 demosite/data/users/videos.

作为php.net

http://php.net/manual/en/ini.list.php

upload_max_filesize "2M" PHP_INI_PERDIR PHP_INI_ALL in PHP <= 4.2.3.

PHP_INI_USER: Entry can be set in user scripts (like with ini_set())
PHP_INI_PERDIR: Entry can be set in php.ini, .htaccess, httpd.conf
PHP_INI_SYSTEM: Entry can be set in php.ini or httpd.conf 

一起

还需要增加post_max_size

post_max_size integer

Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize. If memory limit is enabled by your configure script, memory_limit also affects file uploading. Generally speaking, memory_limit should be larger than post_max_size.

编辑:

您需要重新启动 Apache 以使更改生效。

这可能对您有用。