improve upload.js