Changed upload function, turned error reporting on  for production