Writing own php script for blog. Help with Images!

When you create the blog post, presumably that uses a form structure to accept the text for the post, so couldn’t you use the same form to have the poster select and upload the images from their local PC? Then instead of storing them directly in the database, move them to whatever folder you want (and generate your own filename, if you want to make sure that they don’t clash with anything that’s already there) and store the link?

I haven’t done this personally, but most of the file upload sample code I see is dealing with people uploading images in this way. Or did I misunderstand the question?

Nope I’d say it’s pretty good. I am going with that method. I found out there was a way for a user to upload files to a directory on the server using a form.

What I now need to figure out is how I can get the file name queried into the data table while the image gets stored in a folder when the user selects the file and hits upload.

In other words, I select a file, click upload and the files gets stored on the server while the name gets queried to the table all in one go. I am pretty sure there is a way to do that and if you know of any method, please do share! I have been working on the css for the last couple of days. Maybe when I have the whole thing ready with the php for image upload, I will post it here for reference (if I can get it to work that is lol).

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?