I have created a drag and drop file uploader acctually downloaded from the internet I am trying to save the uploaded files to the database but it's unable to do so can anyone help me out or find a way for me to do so as the files are not moving to the folder neither saving into the database

        if(isset($_FILES['files'])) {
            $errors= array();
            foreach($_FILES['files']['tmp_name'] as $key => $tmp_name ){
                $file_name = $_FILES['files']['name'][$key];
                $file_size = $_FILES['files']['size'][$key];
                $file_tmp  = $_FILES['files']['tmp_name'][$key];
                $file_type = $_FILES['files']['type'][$key];
                $upload_date = date("d-F-Y");

                $query_get = mysqli_query($connection, "SELECT * FROM folderdata WHERE dataname='$file_name'");

                $desired_dir = "./uploads";

                $dir_name = "http://localhost/comicsapp/admin/uploads/".$file_name;

                $query = "INSERT into folderdata (`dataname`, `upload_date`) VALUES ('$file_name', '$upload_date')";

                $confirm = mysqli_query($connection, $query);

                if ($confirm) {
                    $_SESSION["message"] = "Menu updated successfully";
                    header("Location: ./index.php");
                } else {
                    $_SESSION["message"] = "There was some errors please re-enter your information";
                    header("Location: ./index.php");

                echo "Success";

Here is my main index file


?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>
                Putti Forms
        </title> <!-- CSS are placed here --> <link href="https://rawgithub.com/hayageek/jquery-upload-file/master/css/uploadfile.css" rel="stylesheet"> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script src="https://rawgithub.com/hayageek/jquery-upload-file/master/js/jquery.uploadfile.min.js"></script> </head> <body> <div id="fileuploader">Upload</div> <script>
$(document).ready(function() {
</script> </body> </html> 

I forgot to mention as these fields will also be submitting with the above mentioned and when I see on the live browser the form comes up with the given div so now there would be 2 forms though how all this can be done

<form method="POST" action="includes/upload.php" enctype="multipart/form-data">
        <p>First Name</p>
        <input type="text" name="first_name" /><br /><br />
        <p>Last Name</p>
        <input type="text" name="last_name" />
        <br /><br />
        <p>What would you like done to your video?</p>
        <textarea name="description"></textarea><br /><br />
            $chars        = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789";
            $random_chars = substr(str_shuffle($chars), 0, 10); 
        <input type="hidden" name="foldername" value="<?php echo $random_chars; ?>" />
        <input type="file" name="files[]" multiple />
        <br /><br />
        <input type="submit" name="submit" >

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.