Add Gravity Forms File Uploads and Image Uploads to the Media Library

I needed to have images uploaded by users through Gravity Forms be added to my Wordpress media library. Googling for solutions led me to half a dozen plugins wanting $70 and up to solve this seemingly simply problem. Absolutely maddening. For other developers pulling their hair out over this, here's the quick and dirty code [...]