Help plz - Video Uploading

Please help ASAP, this is due real soon.

I am doing a video tube site for a multimedia class, and only have the video insertion script not working. I have no idea what is stopping it and am getting desperate. Am I trying to do too much at once?

name is supposed to be username, although not how to reference from the users table in the db. Will be drawn fron the login in the session ideally, although no idea how.

The video isn’t uploading either. Please help

[php]<?php
if(isset($_POST[‘video’])){

$con=mysql_connect(“localhost”,“xxxxxxxxxx”,“xxxxxx”);
mysql_select_db(“video”,$con);

{
{
$sql = “INSERT INTO video SET
name = '”. mysql_real_escape_string($_POST[‘name’]) ."’,
title = ‘". mysql_real_escape_string($_POST[‘title’]) ."’,
tags = ‘". mysql_real_escape_string($_POST[‘tags’]) ."’,
description = ‘". mysql_real_escape_string($_POST[‘description’]) ."’";
}

$target = “Upload/”;
$target = $target . basename( $_FILES[‘upload_video’][‘title’]) ;
$ok=1;
if(move_uploaded_file($_FILES[‘upload_video’][‘tmp_name’], $target))
{
$query =mysql_query( “INSERT INTO video(video) VALUES (’$target’)”);
echo "The file “. basename($_FILES[‘uploadedfile’][‘name’]). " has been uploaded”;
}

else {
echo “Sorry, there was a problem uploading your file.”;
}

if (!mysqli_query($con,$sql))
{
die('Error: ’ . mysqli_error($con));
}
print(header(“Location: index.php”));

}
}
?> [/php]

Sorry, this was the form that was reference for the script. All on same page

[code]

Title:

 

 

Tags:

 

 

 

Description:

 

 

 

Upload:

 
[/code]

dear god, a couple of hour at best to go… wish me luck in explaining this one

You’re using 2 different versions of MySQL_query. the actual query is using MySQL_query, but your confirmation is using mysqli. Use one or the other. $sql has the wrong syntax. looks like you’re trying to combine an insert and update query. the insert query uses VALUES instead of SET.

There’s no need to define $target twice, you’re not changing paths or dealing with user generated paths. Just do $target = ‘Upload/’. basename( $_FILES[‘upload_video’][‘title’]);

try
[php]<?php
if(isset($_POST[‘video’])) {
mysql_connect(“localhost”,“xxxxxxxxxx”,“xxxxxx”);
mysql_select_db(“video”);

 mysql_query("INSERT INTO video VALUES('".mysql_real_escape_string($_POST['name'])."',

‘". mysql_real_escape_string($_POST[‘title’]) ."’, ‘". mysql_real_escape_string($_POST[‘tags’]) ."’, ‘".mysql_real_escape_string($_POST[‘description’])."’)") or die(mysql_error());

$target = “Upload/”. basename( $_FILES[‘upload_video’][‘title’]) ;

if(move_uploaded_file($_FILES[‘upload_video’][‘tmp_name’], $target)) {
mysql_query( “INSERT INTO video (video) VALUES (’$target’)”);
echo "The file “. basename($_FILES[‘uploadedfile’][‘name’]). " has been uploaded”;
} else {
echo “Sorry, there was a problem uploading your file.”;
}
} ?>
[/php] You have to many } in the script, so the script isn’t running as it should, kinda surprised its running at all.

Sponsor our Newsletter | Privacy Policy | Terms of Service