Jump to content

Need help on this video gallery thing


divinedesigns1

Recommended Posts

hey yall, im trying to insert a video from a form but its not inserting, im using the same script and method that i use from my image gallery which worked wonderful so this is what i have so far

$error = 'Error: ';  if(isset($_GET['valbum_id'])){   $vid = $_GET['valbum_id'];   $vget = mysqli_query($con, "SELECT * FROM valbums WHERE valbum_id='$vid'") or die($error . mysqli_error($con));  }elseif(isset($_POST['valbum_id'])){   $vid = $_POST['valbum_id'];   $vpost = mysqli_query($con, "SELECT * FROM valbums WHERE valbum_id='$vid'") or die($error . mysqli_error($con));  }else{   echo 'You did not select a album';  }  if(isset($_POST['vid_sub'])){   $vupload = $_FILES['vidloader']['name'];   $vsize = $_FILES['vidloader']['size'];   $vtype = $_FILES['vidloader']['type'];   $vtemp = $_FILES['vidloader']['tmp_name'];   // define the formats, extension and size   $vall = array('mov', 'wmv', 'mp4', 'mpeg', 'flv', 'avi');   $vext = end(explode('.', $vupload));   $vmax = 1073741824;   // check if the variable is empty   if(empty($vupload)){	echo 'Kindly Select a file';   }elseif(($vtype == $vall)){	echo 'this format is not allow';   }elseif(($vsize > $vmax) || ($vsize < 0)){	echo 'This File is too large, max size is 1 Gigabytes only';   }else{	$vinsert = mysqli_query($con, "INSERT INTO movie VALUES('', '1', '$vid', now(), '$vext')") or die($error . mysqli_error($con));	// move the uploaded file to the main folder	$video_id = mysqli_insert_id($con);	$video_file = $video_id . '.' . $ext;	$dir = move_uploaded_file($vtemp, 'pages/videos/' . $vid . '/' . $video_file);   }  }

i dont have any errors or anything but its not inserting the video into the database nor move the temp video to the folder, can anyone help me here?

Edited by DDs1
Link to comment
Share on other sites

it looks like you are comparing a extension against a entire array....

   elseif(($vtype == $vall)){		echo 'this format is not allow';}

maybe someting like this....??

elseif(($vtype != "mov") && ($vtype != "wmv") && ($vtype != "mp4") && ($vtype != "mpeg") && ($vtype != "flv") && ($vtype != "avi")){	 echo 'format is not allowed';   }

Edited by Rollins
Link to comment
Share on other sites

You can use in_array to check if an item is in an array. Make sure your error reporting is set to E_ALL like Rollins mentioned and that errors are being displayed, and add additional output to tell you what happened. Maybe $_POST['vid_sub'] is not set, you don't output anything if that is the case.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...