Uploading Multiple files to YAHOO Mail Beta : Part II

Hmmm,

So finally, I am here, with the code that does all the magical asynchronous upload of files. Sure it did take quite some time to get to the exact function, but all this time, the entire solution was staring right into my face !
In my previous blog post, I was exploring the possibility of allowing in YAHOO Mail Beta, the ability to select multiple files in the upload dialog, and uploading them simultaneously. Unable to find out what the "Attach" button exactly does and getting confused by the event handling model, I had decided to directly post to the given URL. That is when I saw that Yahoo Mail seems to use the YUI connection library. Ironically though, the file upload does not happen then.
Call it the result of rest, of non stop playing of Age of Empires, when I looked at the code again today morning, on the brink of giving up, I found how simple it was. The "Attach Button" is not really a button or an image. It is a form input of type file. I did not quite realize that the file upload dialog cannot be actually be invoked using only javascript (need to check this) and requires the user to actually click the button. The nice look was only a style. The button is also inside a form, that actually does the submit. The value of the button is the path of the file, and the target for the frame is some obscure hidden frame. Hence, once the click is captured (after the modal dialog box) , all the button does is automatically submit it.
All I would have to do now is to get the array of files selected for upload, and submit the form, one after another. That should quite do the job, and I can have my greasemonkey script ready !!