Improve upload JavaScript