Fixed ordering of file checks during upload.