more complete image upload functionality