divinedesigns1 Posted March 27, 2013 Share Posted March 27, 2013 (edited) 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 March 27, 2013 by DDs1 Link to comment Share on other sites More sharing options...
Rollins Posted March 27, 2013 Share Posted March 27, 2013 (edited) 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 March 27, 2013 by Rollins Link to comment Share on other sites More sharing options...
Rollins Posted March 27, 2013 Share Posted March 27, 2013 and i was wondering what you use for error reporting.... Link to comment Share on other sites More sharing options...
justsomeguy Posted March 27, 2013 Share Posted March 27, 2013 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 More sharing options...
divinedesigns1 Posted March 27, 2013 Author Share Posted March 27, 2013 ok thanks guys Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now