Page 1 of 1

PHP-MySQL Upload Videos to Remote folder

Posted: Sun Nov 08, 2009 4:33 pm
by evanleondawod
Hi Guys

I am creating a site and i want users to be able to upload videos to a folder on a server, using SQL to store the path of the video and the name.

I have created this Code. And it does upload all the details, but does not upload the video itself...

Code: Select all

 
<?
session_start();
require("connection.php");
 
$title = mysql_real_escape_string($_POST['title']);
$date = mysql_real_escape_string($_POST['date']);
$author = mysql_real_escape_string($_POST['author']);
$type = mysql_real_escape_string($_POST['type']);
$description = mysql_real_escape_string($_POST['description']);
 
$vidName = $_FILES['vid']['name'];
$vidTmp = $_FILES['vid']['tmp_name'];
$vidSize = $_FILES['vid']['size'];
 
$maxFileSize = 2000000;
$filePath = "uploads/videos/".$vidName;
 
    move_uploaded_file($imgTmp, $filePath);
    $query = sprintf("INSERT INTO videos(title, date, author, description, type, vid) VALUES ('%s', '%s', '%s', '%s', '%s', '%s')", $title, $date, $author, $description, $type, $filePath);
    if(!mysql_query($query, $connect)) {
    die(mysql_error());
    } else {
    echo("Choose a video!");
    }
 
?>
 
 
Can anybody tell me where im going wrong or give me some advice?

Thanks,

Evan