Jump to content

PHP-MySQL Upload Videos to Remote folder


edot

Recommended Posts

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...

 

<?
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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.