implemented upload in JS