upload image and set cookie