it works fine for images, but when I try a video (flv) it gives these errors:

Notice: Undefined index: uploadedfile in C:\xampp\htdocs\hhu\login\upload.php on line 22

Notice: Undefined index: uploadedfile in C:\xampp\htdocs\hhu\login\upload.php on line 26

Notice: Undefined index: uploadedfile in C:\xampp\htdocs\hhu\login\upload.php on line 34

Warning: copy() [function.copy]: Filename cannot be empty in C:\xampp\htdocs\hhu\login\upload.php on line 34
You totally failed. click HERE to go back and try again.

this is the code

<?php
require ("../include/connect_to_mysql.php");

//function time!
function savedata(){
    global $_FILES, $_POST, $target;
    $sql = "INSERT INTO `hhu`.`videos` (
`id` ,
`dateAdded` ,
`video` ,
`title` ,
`description`,
`runtime` ,
`keywords`
)
VALUES (
NULL , now( ) , '".mysql_real_escape_string($target)."', '".mysql_real_escape_string($_POST['title'])."', '".mysql_real_escape_string($_POST['description'])."', '".mysql_real_escape_string($_POST['runtime'])."', '".mysql_real_escape_string($_POST['keywords'])."');";
mysql_query($sql);

}
//time to see if the file is uploaded.
$target = "../media/videos/".basename($_FILES['uploadedfile']['name']);

//lets prevent any .php from getting in, and rename with .txt as a security measure
$target = str_replace("php","txt", $target);

//let get the files in the storage directory
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'],$target)){
    //we could echo, but why don't we just go to the file list now?
    savedata();
    header("location: success.php");//redirect them to the listfiles.php page


}else{
    //we failed. Lets try a slightly different method here. instead of moving, try copying
    if(copy($_FILES['uploadedfile']['tmp_name'],$target)){
        //we have success!
        savedata();
        header("location: success.php");
    }else{
        //we totally failed... so lets tell them.
        echo 'You totally failed. click <a href="videoUpload.php">HERE</a> to go back and try again.';
    }
}
?>

    Check with the command print_r($FILES); at the top of your script what the $FILES array actually contains. Clearly, it does not contain a key 'uploadedfile'

      Write a Reply...