Added protection against path manipulation.
Fixed potential encoding errors when sending data by not encoding.
Added content type for png files.