Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/287.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在PHP中上传和移动最大15MB的视频_Php - Fatal编程技术网

如何在PHP中上传和移动最大15MB的视频

如何在PHP中上传和移动最大15MB的视频,php,Php,您可以执行以下操作: $mimg=strtolower(substr($_FILES['video1']['name'], strrpos($_FILES['video1']['name'], '.') + 1)); $ext = $lastid.".".$mimg; $target_dir = "wp-content/plugins/videos/includes/uploads/".$ext; $ss=move_uploaded_file($_FILES["video1"]["tmp_

您可以执行以下操作:

$mimg=strtolower(substr($_FILES['video1']['name'], strrpos($_FILES['video1']['name'], '.') + 1));
$ext =  $lastid.".".$mimg;

$target_dir = "wp-content/plugins/videos/includes/uploads/".$ext;

$ss=move_uploaded_file($_FILES["video1"]["tmp_name"], $target_dir);

$imageFileType = pathinfo($target_dir,PATHINFO_EXTENSION);
//$ex = $lastid.".".$imageFileType;

if($imageFileType != "mp4" && $imageFileType != "avi" && $imageFileType != "mov" && $imageFileType != "3gp" && $imageFileType != "mkv")
{
    echo "File Format Not Suppoted";
} 
else
{
    if($ss){
    $update2=$wpdb->query("update wp_videos set video1='".$ext."' where id='".$lastid."'");
        if($update2)
        echo "uploaded ";
    }
}

您需要在
php.ini中设置
upload\u max\u filesize
post\u max\u size
的值

ini_set('upload_max_filesize', '15M');
ini_set('post_max_size', '15M');
您需要重新启动服务器以使用新配置


如果你不能改变你的php.ini,那你就倒霉了。不能在运行时更改这些值;当执行到达调用
ini\u set()

时,上载大于php.ini中指定值的文件将失败。您需要在php.ini或.htaccess中设置upload\u max\u filesize和post\u max\u size的值:

upload_max_filesize = 15M

post_max_size = 15M

通过增加服务器中的上载大小。搜索如何在php中增加上传大小。不清楚你到底问了什么,对不起。显然,系统中可能上传的文件大小受到php的限制,但是这些设置都有文档记录,学习如何更改这些设置应该没有问题。那么你的问题是什么?你面临什么样的问题?是否有任何错误消息?如果无法增加上载大小限制,则可能需要查看数据分块。createjs.com网站似乎有一个相当不错的教程:警告:帖子内容长度1465553字节超过了第0I行未知的8388608字节的限制。我添加了第二行。我在php.ini中做了更改,但在server@Hak谢谢
; Maximum allowed size for uploaded files.
upload_max_filesize = 40M

; Must be greater than or equal to upload_max_filesize
post_max_size = 40M
Simply add this code in your theme’s functions.php file.
@ini_set( 'upload_max_size' , '64M' );
@ini_set( 'post_max_size', '64M');
@ini_set( 'max_execution_time', '300' );
This code tries to increase upload maximum filesize, post maxiumum size, and maximum execution time limits for your WordPress site. However, this may not work for some WordPress websites.
In that case, you can try adding this code to your .htaccess file in your site’s root folder.
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300

If both of these methods fail, then you can try adjusting these values using php.ini file.

Ref: http://www.wpbeginner.com/beginners-guide/how-to-upload-large-images-in-wordpress/