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

JavaScript

Best way to allow users to upload their own photos and video to a website?

Hey everyone, we're working on allowing our users to upload media for avatars, slideshows etc... just wondering what the best way to do that would be/if anybody out there has experience with this!

1 Answer

Steven Parker
Steven Parker
231,007 Points

An input element on a "multipart" encoded form with a type of "file" will allow the user to choose a file to upload, and then the server can receive the file(s) when the form is submitted and process them, including making them available on other pages.

The exact technique will vary with the server language, but examples should be easily found online for your specific type. Your hosting provider may also have some configuration-driven options to enable this capability.