Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End How to include images in blog post Reply To: How to include images in blog post

#155561
__
Participant

Lets say in my admin panel i have the upload image field, were would the image go?

typically, to your /tmp directory. You would handle the upload from whatever URL your form’s action attribute specifies.

would it go in the mysql database or in the img folder?

That’s up to you. The more common approach is to store the image on the filesystem, while you store the location (and other attributes) in your database. But there are advantages to storing the image itself in the DB, as well – backups, for example, and you’ll never have to worry about keeping the DB and filesystem in sync.

<img src="<?php echo $img_directory'"?> />

I assume $img_directory would actually be the URL to the image.

how do i send the image to the img folder without having to put it there manually myself?

…not sure I follow. You would have to do it yourself (how would the file “know where to go” automatically?).

The php manual has a good section about handling file uploads.