The biggest hurdle is that the script in the mail UI is compacted, and without indentation, it was a little difficult to figure out the exact function that uploads the file. This is complicated by the fact that the mail UI is based on events, with the event names changed for obfuscation. A simple trace using firebug did not really get me to the function in the half hour i spent reading the UI. Most of the event passing and stuff seems to reside in this file.
For now, I just think I would go the way of directly posting the content to this URL. The parameters passed include the content type, filename and the content. As this is quite simple to do, I am planning to get this up and running to start with. However, getting to that specific function that actually takes the file name and does the upload would be finer. Just that I would have to keep updating this till YAHOO implements this as a feature.