html表单上传到数据库[关闭]

I have a working HTML form that allows people to attach some images and fires it off. I would like to store the content of the form in a database (except for the images) and upload the images to a folder on the hosting site.

The image names would be placed in their own folders (using epoch time as the folder name) and their names inserted into the db as well as the timestamp for later retrieval.

the code executes without error but nothing uploads and nothing makes it into the database. for now I am using a simplified code and not doing much checking (cut me some slack there) as this is simply proof of concept.

<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
define('HOST', 'xxx');
define('DB', 'xxx');
define('USER', 'xxx');
define('PASS', 'xxx');
/*not being used for now, will be later in production
function mts_sanitize($data) {
//clean the input
$string = mysqli_real_escape_string($data);
$string = htmlentities($data);
return $string;
}*/
function insertmessage($msg, $filesmts, $intime) {
//get the message and file names nad insert them into the db
$fileloc = implode(":", $filesmts);
$conn = new mysqli(HOST, USER, PASS, DB);
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
$sql = "INSERT INTO submissions ('time', 'message', 'files') VALUES ($intime, $msg, $fileloc)";
if ($conn->query($sql) === TRUE) {
    uploadimg($files, $filenames, $intime);
    } else {
        echo "Error: " . $sql . "<br>" . $conn->error;
    }
}
function uploadimg($files, $filenames, $intime) {
    //upload the actual images
    $target_dir = "forms/uploads/".$intime."/";
    foreach($files as $k=>$v) {
        $target_file = $target_dir.$filesnames[$k];
        move_uploaded_file($v, $target_file);
    }

}

This is the first time I have tried to upload files through a form.

Edit:

Lets assume for arguments sake that my form is not broken, that it actually works, which it is... I am simply trying to see if there is anything done wrong with this particular set of functions. they are not erroring on me but not doing their job and I simply am having a hard time figuring this out.

My message is a string formatted as such to be readable when I pull it from the database (escaped characters). the file names are derived like so:

    // Temporary paths of selected files
    $file1 = $_FILES['image1']['tmp_name'];
    $file2 = $_FILES['file2']['tmp_name'];
    $file3 = $_FILES['file3']['tmp_name'];
    $file4 = $_FILES['file4']['tmp_name'];
    $file5 = $_FILES['file5']['tmp_name'];

    // File names of selected files
    $filename1 = $_FILES['image1']['name'];
    $filename2 = $_FILES['file2']['name'];
    $filename3 = $_FILES['file3']['name'];
    $filename4 = $_FILES['file4']['name'];
    $filename5 = $_FILES['file5']['name'];]

    $files = array($file1, $file2, $file3, $file4, $file5);
    $filenames = array($filename1, $filename2, $filename3, $filename4, $filename5);

I then call the function right before the message sends like so:

//validation code above
require_once('dbinsert.php'); //My file that is pasted above
$intime = time();
insertmessage($msgmts, $filenames, $intime);
//sending code below. Again this works with out error and sends the email.

the $files array never makes it in to the uploadimg function. this function is called inside insertmessage which does not have $files passed to it