No i don't think that will be easy The JavaScript engine executes within the context of the repository - it has no access to web-client beans or JSF upload components etc. It would need some custom code to stream the content to a location that the JavaScript engine could access before it could deal with the uploaded content.
My questions are: Is different the source code from the Alfresco Enterprise ?? Can we use this object on Alfresco Community ?? How can we upload files??