How to upload images into database with pdo or only image name and image move into folder

Member Avatar

The sql is basically the same whatever flavour of mysql functions/connection method that you use.

So what do you want? file insert as blob or filename and upload to folder? Please don't say both. Have you researched this as there are hundreds of tutorials out there on this?

Specifically, which part of this are you having trouble with? Show your code so far.

This is my code:


            try {

                $postSlug = slug($postTitle);

                //insert into database
                $stmt = $db->prepare('INSERT INTO blog_posts_seo (postTitle,postSlug,images,postDesc,postCont,postDate) VALUES (:postTitle, :postSlug, :images, :postDesc, :postCont, :postDate)') ;
                    ':postTitle' => $postTitle,
                    ':postSlug' => $postSlug,
                    ':images' => $images,
                    ':postDesc' => $postDesc,
                    ':postCont' => $postCont,
                    ':postDate' => date('Y-m-d H:i:s')
                $postID = $db->lastInsertId();

How to work?

Member Avatar

So what's the problem?