added logics for uploading images