Jump to content

Weired Script Execution Problem


heminfotech

Recommended Posts

Hi Guys

 

I need a Help Please. I have a weired problem of uploading the video and converting it to flv.

 

I have a script written where first the original file get uploaded and then get converted into FLV file and the image for the same is extracted from the video. Please have a look at below code. when I submit the form the form start executing this code. Once the code started it uploads all the three above given file and they are converted very well so there is no issue for the same. But after that it goes into comma like status and shows the dialog in the attached image.

 


<?php	
include_once("db.php");
include_once("dbcon.php");
session_start();


function GetExt($Filename)
{
$Extension = explode(".", $Filename);
   	$Extension_i = (count($Extension) - 1);
   	return $Extension[$Extension_i];
}
   	
// How to use it


if(isset($_POST) && isset($_FILES))
{


$title=$_POST['title'];
$desc=$_POST['desc'];
$keywords=$_POST['keywords'];


switch ($_POST['category']) {
	case 1:
		$imgcat = "animals/pets"; break;
	case 2:
		$imgcat = "people"; break;
	case 3:
		$imgcat = "travel"; break;
	case 4:
		$imgcat = "children"; break;
	case 5:
		$imgcat = "sports"; break;
	case 6:
		$imgcat = "nature"; break;
	case 7:
		$imgcat = "action"; break;
	case 8:
		$imgcat = "humor"; break;
	case 9:
		$imgcat = "portraiture"; break;
	case 10:
		$imgcat = "other"; break;
}


if(isset($_FILES['videofile']['name']))
{


	ini_set("post_max_size", "25M");
	ini_set("upload_max_filesize", "25M");
	ini_set("memory_limit", -1 );
	ini_set("max_input_time", -1);
	set_time_limit(0);

	$vid_file=str_replace(" ","_",$_FILES['videofile']['name']);


	if(!empty($vid_file))
	{
		$ext=GetExt($vid_file);
		$flv_filename=substr($vid_file,0,(strlen($vid_file)-strlen(GetExt($vid_file))-1));
		$imgpath=$flv_filename.".jpg";
		$flv_filename.=".flv";

		if($_FILES['videofile']['type']!="video/mpeg" && $_FILES['videofile']['type']!="video/x-msvideo" && $_FILES['videofile']['type']!="video/vnd.mpegurl"  && $_FILES['videofile']['type']!="video/x-ms-wmv" && $_FILES['videofile']['type']!="video/x-ms-asf" && $_FILES['videofile']['type']!="video/x-flv" && $_FILES['videofile']['type']!="video/quicktime" && $_FILES['videofile']['type']!="video/x-ms-wvx")
		{
			$msg="Image File must be mpeg, mpg, mpa, avi, m4u, wmv, wmv3, asx, flv, mov, wvx!!!";
			header("Location: index.php?q=video_upld&msg=$msg");
			exit();
		}

		/*if($_FILES['videofile']['size']>102400){
			$msg="Your file exceeded to 100 KB !!!";
			header("Location: index.php?q=video_upld&msg=$msg");
			exit();		
		}	*/	


		$add = "video/".$vid_file;
		if(move_uploaded_file($_FILES['videofile']['tmp_name'], $add))
		{
			echo "uploaded sucessfully";

		}
		else
		{
			echo "Unsuccessful";

		}
		chmod("$add",0777);

		exec("ffmpeg -i ".$vid_file." -b 100k -ar 22050 -y video/".$flv_filename);
		exec("ffmpeg -i ".$vid_file." -an -ss 00:00:10 -r 1 -vframes 1  -f mjpeg -y video/".$imgpath);


	}

	$type=$_FILES['videofile']['type'];
	$size=$_FILES['videofile']['size'];
	//print_r($_POST);
	//print_r($_FILES);

	$t=time();
	$ins_video="insert into `pixyak`.`video` (title, description, member, keywords, category, 
				type, size, flvpath, path, imgpath, ext, cre_dt, mod_dt, status)	values
				('$title', '$desc', '".$_SESSION['user_name']."', '$keywords', '$imgcat', '$type', '$size', '$flv_filename', '$vid_file', 
				'$imgpath', '$ext', '$t', '$t', 'Active')";
	//echo $ins_video;
	mysql_query($ins_video);

	if(mysql_affected_rows()==1)
	{
		$insId=mysql_insert_id();

		if ($_POST['around']){

			$country=addslashes($_POST['country']);
        		$city=addslashes($_POST['city']);
			$desc1=addslashes($_POST['desc1']);		

			mysql_query("insert into world_vid values ('','".$insId."','".$_SESSION['user_name']."','','".time()."','0','".addslashes($title)."','".$desc1."','".$country."','".$city."',0,0,0)");

		}	

		$msg="Video Uploaded Successfully";
		header("location: index.php?q=video_upld&msg=$msg");
		die();				
	}
	else
	{
		$msg="Error: ".mysql_error();
		header("location: index.php?q=video_upld&msg=$msg");
		die();
	}

	//ob_flush();
}
}
else
{
//ob_flush();
$msg="Access Denied";
header("location: index.php?q=video_upld&msg=$msg");
die();
}

?>

 

And I am also attaching the image of the dialog box too. Please help me I can't understand y it gets Stuck with the same. Thanks very much for all your support

 

phpfreak.JPG

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.