Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Patrick Metcalfe
PLUS
Patrick Metcalfe
Courses Plus Student 7,563 Points

Blog Images and Resources

So I making a php blog platform and I'm wondering how to deal with images and stuff like that in MVC Php. I'm storing each blog post in a db and each has a title pub_date content etc. but how do i go about putting an image? I get that I could just write it as <img src=""> but where do I keep the photo in my project. Each post doesnt have its own folder with resources? Thanks

1 Answer

Pretty much you don't store it in the database unless it is a blob. The trick is the put it in a directory on the web host . Just look at the docs for this function move_uploaded_file()