php-PHP實現視頻上傳與播放,代碼出現問題,求解!上傳圖片後提示沒有上傳檔案或檔案大於300M,是什麼原因?

來源:互聯網
上載者:User
關鍵字 視頻 php
視頻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('上傳圖片失敗!');history.go(-1);";
exit();
}
}else{
echo "alert('上傳圖片格式錯誤!');history.go(-1);";
exit();
}
}else if($_FILES[tb_video_picture][size] > 700000){
echo "alert('上傳圖片大小超出範圍!');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 "";                    exit();                }            }else{                echo "";                exit();            }        }else{            echo "";            exit();        }}/*else{    echo "";    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 "";

include_once("subscibe.php");
exit();
}else{
echo "alert('添加失敗');history.go(-1);";
exit();
}
?>

  • 相關文章

    聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.