Fixed file upload error handling.

Thanks to Daouda Kanoute for the report.
Merge branch 'master' into gh-pages