2 shiguanglqx shiguanglqx 于 2016.04.01 18:29 提问

PHP实现视频上传与播放,代码出现问题,求解!上传图片后提示没有上传文件或文件大于300M,是什么原因? 1C

<?php
session_start();
include "conn/conn.php";
//判断文件后缀
//$f_type:允许文件的后缀类型
//$f_upfiles:上传文件名
function f_postfix($f_type,$f_upfiles){
$is_pass = false;
$tmp_upfiles = split(".",$f_upfiles);
$tmp_num = count($tmp_upfiles);
for($num = 0; $num < count($f_type);$num++){
if(strtolower($tmp_upfiles[$tmp_num - 1]) == $f_type[$num])
$is_pass = $f_type[$num];
}
return $is_pass;
}
$p_type = array("jpg","jpeg","bmp","gif","png");
$f_type = array("avi","rm","rmvb","wav","mp3","mpg");
$video_path = "upfiles/video";
$picture_path =" ";
$file_path = "";
/* 判断上传图片类型和文件大小,上传图片 */
if($_FILES[tb_video_picture][size] > 0 and $_FILES[tb_video_picture][size] < 700000){
if(($postf = f_postfix($p_type,$_FILES[tb_video_picture][name])) != false){
$picture_path = time().".".$postf;
$tb_video_picture=$video_path."/".$picture_path;
if($_FILES[tb_video_picture][tmp_name])
move_uploaded_file($_FILES[tb_video_picture][tmp_name],$video_path."\".$picture_path);
else{
echo "alert(&#39;上传图片失败!&#39;);history.go(-1);";
exit();
}
}else{
echo "alert(&#39;上传图片格式错误!&#39;);history.go(-1);";
exit();
}
}else if($_FILES[tb_video_picture][size] > 700000){
echo "alert(&#39;上传图片大小超出范围!&#39;);history.go(-1);";
exit();
}else{
$picture = "";
}

/******************************/
/*  判断上传文件类型与大小,上传文件  */
if($_FILES[tb_video_address][size] > 0){
    //如果是音频文件
        if($_FILES[tb_video_address][size] < 700000000000000000000){
            if(($postf = f_postfix($f_type,$_FILES[tb_video_address][name])) != false){
                $file_path = time().".".$postf;
$tb_video_address=$video_path."/".$file_path;
                if($_FILES[tb_video_address][tmp_name])
                    move_uploaded_file($_FILES[tb_video_address][tmp_name],$video_path."\\".$file_path);
                else{
                    echo "<script>alert('上传文件错误!');history.go(-1);</script>";
                    exit();
                }
            }else{
                echo "<script>alert('上传文件格式错误!');history.back(-1);</script>";
                exit();
            }
        }else{
            echo "<script>alert('上传文件大小错误!');history.go(-1);</script>";
            exit();
        }
}
/*else{
    echo "<script>alert('没有上传文件或文件大于300M');history.go(-1);</script>";
    exit();
}*/

/****************/
/*  相同的信息  */
$tb_video_name = $_POST[tb_video_name];                 //视频名称
$tb_video_type = $_POST[tb_video_type];         
$tb_video_explain = $_POST[tb_video_explain];
$tb_video_author = $_POST[tb_video_author];
$tb_video_date = date("Y-m-d H:i:s");
/*****************/

    $a_sqlstr = "insert into tb_video (tb_video_name,tb_video_picture,tb_video_type,tb_video_address,tb_video_author,tb_video_date,tb_video_explain,tb_video_auditing) values('$tb_video_name','$tb_video_picture','$tb_video_type','$tb_video_address','$tb_video_author','$tb_video_date','$tb_video_explain','0')";

/***************************/

$a_rst = $conn->execute($a_sqlstr);
if(!($a_rst == false)){

$b_sqlstr="select * from tb_up_video where tb_video_user='$tb_video_author'";
$b_rst=$conn->execute($b_sqlstr);

$arrays=$b_rst->GetRows();
if(count($arrays)<=0){

$b1_sqlstr="insert into tb_up_video (tb_video_user,tb_up_counts)values('$tb_video_author','1')";
$b1_rst=$conn->execute($b1_sqlstr);

}else{
$b2_sqlstr="update tb_up_video set tb_up_counts=tb_up_counts+1 where tb_video_user='$tb_video_author'";
$b2_rst=$conn->execute($b2_sqlstr);
}

    echo "<script>alert('添加成功');window.location.href='trans.php';</script>";

include_once("subscibe.php");
exit();
}else{
echo "alert(&#39;添加失败&#39;);history.go(-1);";
exit();
}
?>

1个回答

devmiao
devmiao   Ds   Rxr 2016.04.01 23:11
shiguanglqx
shiguanglqx 你知道是哪里的问题吗?我看不出来
一年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!