Fix image upload issue.

fixes #1377