image upload and cleanup