simplify error handling and avoid code duplication (thanks Romain for advices)
Attach a file by drag & drop or click to upload