Bug fix for document upload.  Document entry is no longer created in
database if file upload fails. Also whitespace cleanup (tabs to spaces)