Fixed "Invalid Upload Request" by setting object size first in for loop.
Now i can upload images of given size. Upload is very slow, must be doing something wrong (to be corrected).