if (count($_FILES) > 0) {

    if (is_uploaded_file($_FILES['userImage']['tmp_name'])) {

        $imgData = addslashes(file_get_contents($_FILES['userImage']['tmp_name']));
        $imageProperties = getimageSize($_FILES['userImage']['tmp_name']);

        $sql = "INSERT INTO trial (imageType ,imageData,uploaded_on, user_id,tax_payer_id)
                VALUES('{$imageProperties['mime']}', '{$imgData}',NOW(),'".$_SESSION['id']."','".$_GET['id']."')";
        $current_id =  mysqli_query($db, $sql) or die("<b>Error:</b> Problem on Image Insert<br/>" . mysqli_error($db));
        $current_id = mysqli_insert_id($db);

        if (isset($current_id)) {
           echo "Upload Succesfully";
        }else{
            echo "There is a problem";
        }
    }
}
?>  

    <form name="frmImage" enctype="multipart/form-data" action="" method="post"                         class="frmImageUpload">
        <label>Upload QrCode File:</label><br /> 
        <input type="file" class="inputFile" name="userImage" />
                <input type="hidden" name="imageID"  value="<?php if(!empty($_GET['id'])){ echo $_GET['id'];} ?>">
        <input type="submit" value="Submit" class="btnSubmit" />
    </form>

I'm trying to upload multiple images and I'm using longblob to store the images in database.

Is there something about this that isn’t working that you need help with, or are you just sharing your code?

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.