There are some tutorials out there similar to this, but WordPress has since updated their media uploader, making those tutorials obselete. This code is essentially a combination of the best ones I’ve found
Javascript
first, you’ll want to save this code into a .js file, say “uploader.js”
Read more »