Changed FileRef upload to manage error conditions