app.js updated error check for upload