I have an
imageView.sd_setImage(with: URL(string: url), placeholderImage:UIImage(named:"image_icon"))
Your image is carrying EXIF data. I guess you are getting data to upload using UIImageJPEGRepresentation which includes orientation information. Try using UIImagePNGRepresentation because png images does not carry orientation information. I had the same problem earlier. Try and reply if works.