Added logic to image uploads