image upload function is working partially