Fixed upload issue and added attachment handler