Fixes error message and improves unique name of uploaded file