I think you should be able to change the test() function so that it dynamically takes the nameof the control that you want to work with as a parameter.
Eg. pseduo code
This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks.
I had to provide a way for user…