check before overwriting file
strip path from filename when sending, fixes #1