Friday, October 16, 2015

Upload BY FTP


if(!empty($submitne))
{
$form_data = $fwRequest->getParam('ne_days', array());
$tblne_days = new Fw_Db_Table('ne_days');

$ext = strtolower(array_pop(explode('.',$_FILES['video']['name'])));

$video_ext = array("flv");

//if(in_array($ext,$video_ext))
//{
$video_name = time()."_".$_FILES['video']['name'];
$destination=BASE_DIR ."upload/video/".$video_name;


$ch = curl_init();
$file = $_FILES['video']['tmp_name'];
$fp = fopen($file, 'r');
curl_setopt($ch, CURLOPT_URL, 'ftp://whamcmsc:ejV61I77rv@whamcms.com/public_html/bvps/upload/video/'.$video_name);
curl_setopt($ch, CURLOPT_UPLOAD, 1);
curl_setopt($ch, CURLOPT_INFILE, $fp);
curl_setopt($ch, CURLOPT_INFILESIZE, filesize($file));
curl_exec ($ch);
$error_no = curl_errno($ch);
curl_close ($ch);
if ($error_no == 0) {
$screenshotname = str_replace($ext,'jpg',$video_name);
captureImageFromVideo($screenshotname,$video_name);

if(!in_array($ext,$video_ext))
{
$flvname = str_replace($ext,'flv',$video_name);
convertToflv($flvname,$video_name);
$form_data['video']=$flvname;
}
else
{
$form_data['video']=$video_name;
}


} else {
//echo $error_no;
die('Sorry, Video file not supported type.');
}


//}
}

No comments:

Post a Comment