Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

Script not working - video file not uplodoading

Links for php scripts

Moderators: macek, egami, gesf

Script not working - video file not uplodoading

Postby Damolys001 » Fri Apr 06, 2012 8:01 am

if($_POST['Upload']=='upload')
{

//$uploaddir is for videos before conversion
$uploaddir = '../uploads/videos/';
//$live_dir is for videos after converted to flv
$live_dir = '../uploads/live/';
//$live_img is for the first frame thumbs.
$live_img = '../uploads/images/';
$news = mysql_query( "SELECT * FROM `video` ") or die (mysql_error()); $number_of_row = mysql_num_rows($news);
$seed = rand(1,2009) * rand(1,10);
$seed= ((int)$number_of_row + 1 ).'_'. $seed;
$upload = $seed. basename($_FILES['vid_file']['name']);
$uploadfile = $uploaddir .$upload;
$tittle = sizeinput($_POST['tittle'], 50);
$content = sizeinput($_POST['content'], 200);
$vid_cat = (int)$_POST['category'];
$vid_usr_ip = $_SERVER['REMOTE_ADDR'];
$safe_file = checkfile($_FILES['vid_file']);
$userId = $_SESSION['name'];
$location = $_SESSION['location'];
$time = date("D d M Y", time()); echo "attempt chananging!\n";

//create query to store video
$sql= mysql_query("INSERT INTO `dtc`.`video` (`id`, `name`, `location`, `title`, `description`, `dateNow`, `videoLink`, `category`)
VALUES (NULL, '$userId', '$location', '$tittle', '$content', '$time', '$upload', '$vid_cat' );" ) or die (mysql_error());
$erorrMsg = $erorrMsg. '<img src="'.$new_image_path.'" /><br/>
<h3>'.$tittle.'</h3>';


if(isset($safe_file))
{
if (isset($safe_file))
{ echo "attempt chananging!\n";

$erorrMsg =$erorrMsg. "File is valid, and was successfully uploaded.<br/>";
$base = basename($uploadfile, $safe_file['ext']);
$new_file = $base.'flv';
$new_image = $base.'jpg';
$new_image_path = $live_img.$new_image;
$new_flv = $live_dir.$new_file;





//ececute ffmpeg generate flv
exec('ffmpeg -i '.$uploadfile.' -f flv -s 320x240 '.$new_flv.'');
echo "attempt chananging!\n";
//execute ffmpeg and create thumb
exec('ffmpeg -i '.$uploadfile.' -f mjpeg -vframes 1 -s 150x150 -an '.$new_image_path.'');
$erorrMsg =$erorrMsg. 'Thank You For Your Video!<br>';

move_uploaded_file($_FILES['vid_file']['tmp_name'], $uploadfile);

}
else
{
$erorrMsg = $erorrMsg. "Possible file upload attack!\n";
print_r($_FILES);

echo "Possible file upload attack!\n";
}

}
else
{

$erorrMsg = $erorrMsg. 'Invalid File Type Please Try Again. You file must be of type
.mpg, .wma, .mov, .flv, .mp4, .avi, .qt, .wmv, .rm';

}
}
Damolys001
New php-forum User
New php-forum User
 
Posts: 1
Joined: Fri Apr 06, 2012 7:57 am

Re: Script not working - video file not uplodoading

Postby FishBird » Thu Apr 12, 2012 10:00 am

What is the max_post_size in your php.ini?
FishBird
New php-forum User
New php-forum User
 
Posts: 21
Joined: Thu Apr 12, 2012 8:05 am


Return to PHP Scripts

Who is online

Users browsing this forum: Google [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron