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不好啊,什么编这个有什么意思啊之类无聊的话,谢谢!!!
小弟刚来,分没有,有分之后一定补上!!
展开