The dialog is built in such a way that we can probably re-use most of it for other upload tasks. At the moment, I would like to focus on message entry. Rewriting the upload dialog wasn't actually what I started out trying to do. My goal was to eliminate all of the round-trips to the server during message composition. Originally I wanted to just add 'attach' fields to the form as they were needed, like GMail does, but it ended up looking very bad so I got the idea to do the popup dialog. Where I am going with this: The next step will be to perform a final validation on the message using ajax before submitting the entire message. If there are bad recipients or an access control problem, I want it to pop up an error. Only when everything is validated will the full message form finally be submitted to the server.
The final goal is for the entire system to be usable without logging in. That's the main reason I added the modal dialog code last week.