I have a upload for a video to go to a folder but the upload works and not the generation from the video i have tried echo and i have googled this problem but no results so far if i could get any one to help it would be appreciated.
CODE:
<?php
if(!isset($_SESSION['fname']) && !isset($_SESSION['username']) && !isset($_SESSION['email'])) {
redirect_to("index.php");
} else {
if(isset($_POST['submit'])) {
$allowedExts = array("jpg", "jpeg", "gif", "png", "mp3", "mp4", "wma");
$extension = pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);
if (in_array($extension, $allowedExts))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
}
else
{
if (file_exists("uploads/" . $_FILES["file"]["name"]))
{
echo $_FILES["file"]["name"] . " already exists. ";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],
"uploads/" . $_FILES["file"]["name"]);
$target_path = 'uploads/Sequence 01.mp4';
$imgPath = 'thumbs/thumb.jpg';
echo exec("ffmpeg -itsoffset -0 -i uploads/" . $_FILES["file"]["name"] . " -vcodec mjpeg -vframes 0 -an -f rawvideo -s 200x200 thumbs/" . $_FILES["file"]["name"] . ".jpg");
$name = $_SESSION["username"];
$sql = "INSERT INTO `videos`(`filename`, `user_uploaded`, `previewfn`) VALUES ('{$_FILES["file"]["name"]}','{$name}','{$_FILES["file"]["name"]}.jpg')";
$result = mysqli_query($db, $sql);
}
}
}
else
{
echo "Invalid file";
}
}
}
?>
<form action="upload-video.php" method="post" enctype="multipart/form-data">
<label for="file"><span>Filename:</span></label>
<input type="file" class="btn bg-danger" name="file" id="file" />
<br /><br />
<input type="text" class="input" name="title" id="title" />
<input type="submit" name="submit" class="btn" value="Submit" />
</form>