ourloop 0 Newbie Poster

Hi,

This code is from an older thread. I'm want to use the code, but I'm having some difficulty with the MySQL table creation.

Here's the code:

<?
session_start();
require("connection.php");

if(isset($_POST['submit_btn_name']) && $_POST['submit_btn_name']!='')
{
$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($vidTmp, $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!");
	}

}


?>

Here is what I believe is the correct MySQL table creation code. However, I can not seem to make this work.

CREATE TABLE `UploadedFiles` (
`UploadedFileID` int(11) NOT NULL auto_increment,
`title` varchar(30) default NULL,
`date` varchar(30) default NULL,
`author` varchar(30) default NULL,
`type` varchar(30) default NULL,
`description` varchar(30) default NULL,
`vidName` varchar(30) default NULL,
`vidTmp` varchar(30) default NULL,
`vidSize` int(11) default NULL,
`content` longblob,
PRIMARY KEY (`UploadedFileID`)
) TYPE=MyISAM;

I haven't started with the PHP upload form, as I need the MySQL info first.

Any advice would be musch appreciated. Thanks in advance.

James

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.