You have to find a way to communicate the information without saying "you're doing it wrong".
One possibility might be to pair-program with him on the problem. Then you can change it from "you're doing it wrong, you should do it like this" to "we're doing it wrong, we should do it like this", or even better, "we might be doing it wrong - could we try doing it like this?". That's much easier for him to take, because you're putting both of you on the same side.
Of course, if he's a lone wolf who won't take advice, then he won't want to pair program. You could try phrasing it as "can i pair with you to understand your solution?", which he might be more likely to accept, but then he'll start off being resistant to any ideas you contribute, because what you've asked for is a one-way conversation.
An alternative might be to apply the Socratic method - ask questions that lead him to work out for himself that you're right. So rather than "that won't work because the temporary files will be deleted at boot", you start with "where are you keeping the data?", "does anything special happen to those files at any time?", "how about at boot?", etc. The advantage of this is that the only facts or assertions introduced into the conversation come from him, prompted by your questions, so if they lead to the conclusion that he's wrong, he can't resist it, because he's got there himself. If he's defensive about his ideas, then it's natural to lead him into this discussion, because he'll want to defend himself by explaining. The problem, of course, is that the flaw in his thinking might not be in his logic, but in his understanding of the facts. For instance, if he doesn't think temporary files get deleted at boot, this approach fails. But then, at least you can drill down to the specific points where he's wrong, and it should be easier to apply a facthammer to those than to the problem as a whole.
A nice feature of the Socratic method is that if it turns out that you're wrong, it will also reveal that!
But mostly, if he gets things wrong and won't listen to advice from colleagues, he needs to be fired. Make sure your boss is aware of this problem.