changes to upload.js for POST errors