Instead of trying to do the heavy lifting in the API itself, use the existing features of the ProjectFinder.
Attach a file by drag & drop or click to upload