Improved error handling in upload form