Fix file uploading issue in web interface

Fixed occasional crash when uploading file attachments through the web interface.

File uploads would occasionally causea crash in the web server which would require the file to be re-uploaded. Only a small number of users were impacted intermittently, but we are really happy to get rid of this bug.

We know it was frustrating for those users and it definitely was for us seeing it happen. Good riddance.