php mysql上传视频_php 视频网站视频上传存入mysql,index.php,表单传到upload.php处理,要求上传的视频转为flv,还要截图...

index.phh:标题:文件:inputtyp...

index.phh:标题:

文件:input type="hidden" name="action" value="upload" />

但是传到upload.php,我不会处理,大家帮我改正出来。

upload.php:

$title=$_POST['title'];$movie=$_POST['movie'];

require('../include/mysql.class.php');

$db=new Mysql;

//视频转码

function converttoflv( $in, $out )

{

if(is_file($out)) unlink( $out );

$cmd = $db->root . "\\flvtool\\ffmpeg.exe -v 0 -i $in -ar 11025 -qscale 6 -s 480x360 $out 2>&1";

$fh = popen( $cmd, "w" );

if(!$fh)die("ERROR!");

while( fgets( $fh ) ) { }

pclose( $fh );

}

//视频截图

function getthumbnail( $in, $out )

{

if(is_file($out)) unlink( $out );

$cmd = $db->root . "\\flvtool\\ffmpeg.exe -i $in -y -f image2 -t 0.001 -s 480x360 $out 2>&1";

$fh = popen( $cmd, "r" );

while( fgets( $fh ) ) { }

pclose( $fh );

}

//视频转码并截图

function flv_import( $upfile, $fname, $title )

{

$fname = preg_replace( '/\..*$/', '', basename( $fname ) ); //上传视频以时间日期和随机数组合来命名

$flvpath = $fname.".flv";

$thumbpath = $fname.".jpg";

converttoflv( $upfile,$db这个地方用$db对不对???->root ."\\movies\\$flvpath" );

getthumbnail( $upfile,$db->root ."\\movies\\$thumbpath" );

$db=new Mysql;

$db->fn_insert("video这是数据表","title,movie,image///这是截图"," '$title','movies/$flvpath','movies/$thumbpath' ");

///就是上面这一段代码,我不会处理,求帮我处理一下……

header('refresh:2;url=index.php');

echo"

新增成功!正在跳转……

";

}

flv_import( $_FILES['movie']['tmp_name'], $_FILES['movie']['name'],$title); //调用的这段函数,我好像也写的不太对

ob_end_flush();

?>

给出mysql.class.php和本页有关的代码:

require('db.config.class.php');//包含datebase类

class Mysql{

private $localhost;

private $root;

private $password;

private $database;

function __construct(){

$this->localhost=Database::$dblocalhost;

$this->root=Database::$dbroot;

$this->password=Database::$dbpwd;

$this->database=Database::$dbname;

$this->connect();

}

function fn_select上面存入数据库调用的函数($table,$select,$where="",$order="",$limit=""){$sql="select $select from $table $where $order $limit";

$result=mysql_query($sql) or die("查询失败".mysql_error());

return $result;

}

?>

db.config.class.php:

class Database{

static $dblocalhost="localhost";

static $dbroot="root";

static $dbpwd="";

static $dbname="online video";

}

?>

高手进来,说废话的赚分的请绕道,不要浪费我们学习的时间,只要给出答案,不要在哪里说什么php不好啊,什么编这个有什么意思啊之类无聊的话,谢谢!!!

小弟刚来,分没有,有分之后一定补上!!

展开

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值