Writing own php script for blog. Help with Images!

Part of the file upload code will be to move the uploaded file into the correct directory and give it an appropriate name. Surely you can just keep this destination filename and store it along with the blog post text in your database? So your form post will take the file(s) from the ‘input type=“file”’ code, as well as the blog text, handle the file uploads and moves, then post the blog text and file information all in one go?