added missing handleError function, added work folder for uploads