I'm having trouble getting my PHP code to upload videos. I have a page that uploads Images, which uploads to a table called Photos and everything works fine. I tried modifying that code to upload videos to a table called Videos, but I don't see the files in the folder that I assigned it to. There are no errors when I upload the file, and the file size and type is within the conditions that I set. Any suggestions, this is my code:
function valid($img_ext) {
$ext = array(
//ext types
'video/wmv' => 'wmv',
'video/mov' => 'mov',
);
if(array_key_ex ists($img_ext, $ext)){
return true;
break;
}
else
return false;
}
if(valid($_FILE S['uploadvideo']['type']) == true){
if ($_FILES["uploadvide o"]["size"] < 10240000){
if ($_FILES["uploadvide o"]["error"] == false){
//Uploads and stores in temporary location for further verification
$_FILES["uploadvide o"]["$name"];
$_FILES["uploadvide o"]["tmp_name"];
if (file_exists("V ideos/Orig/".$_FILES["uploadvide o"]["name"])){
echo $_FILES["uploadvide o"]["name"], " already exists. ";
}
else{
move_uploaded_f ile($_FILES["uploadvide o"]["tmp_name"], "Videos/Orig/" . $_FILES["uploadvide o"]["name"]);
//calls the thumbnail maker function
//imageThmb();
$src = $_FILES["uploadvide o"]["name"];
$thumb = "thmb_".basenam e($_FILES['uploadvideo']['name']);
mysql_query("IN SERT INTO `ttakara`.`Vide os` (`ID` ,`name`, `description` ,`Link_Orig` ,`Link_Thumb` ,`approve`, `User_ID` ) VALUES ('' , '$name', '$description', '$src', '$thumb', 0, '');");
}
}
//Prints an error if image failed to upload
else{
echo "Error: ".$_FILES["uploadvide o"]["error"]."<br />";
}
}
else{
//alerts user that the image is too large
echo "<script>alert( 'The image you are trying to upload is too large.')</script>";
}
}
function valid($img_ext) {
$ext = array(
//ext types
'video/wmv' => 'wmv',
'video/mov' => 'mov',
);
if(array_key_ex ists($img_ext, $ext)){
return true;
break;
}
else
return false;
}
if(valid($_FILE S['uploadvideo']['type']) == true){
if ($_FILES["uploadvide o"]["size"] < 10240000){
if ($_FILES["uploadvide o"]["error"] == false){
//Uploads and stores in temporary location for further verification
$_FILES["uploadvide o"]["$name"];
$_FILES["uploadvide o"]["tmp_name"];
if (file_exists("V ideos/Orig/".$_FILES["uploadvide o"]["name"])){
echo $_FILES["uploadvide o"]["name"], " already exists. ";
}
else{
move_uploaded_f ile($_FILES["uploadvide o"]["tmp_name"], "Videos/Orig/" . $_FILES["uploadvide o"]["name"]);
//calls the thumbnail maker function
//imageThmb();
$src = $_FILES["uploadvide o"]["name"];
$thumb = "thmb_".basenam e($_FILES['uploadvideo']['name']);
mysql_query("IN SERT INTO `ttakara`.`Vide os` (`ID` ,`name`, `description` ,`Link_Orig` ,`Link_Thumb` ,`approve`, `User_ID` ) VALUES ('' , '$name', '$description', '$src', '$thumb', 0, '');");
}
}
//Prints an error if image failed to upload
else{
echo "Error: ".$_FILES["uploadvide o"]["error"]."<br />";
}
}
else{
//alerts user that the image is too large
echo "<script>alert( 'The image you are trying to upload is too large.')</script>";
}
}
Comment