How long ago did you go through foreclosure? The standard waiting period is seven years, but in thecase of extenuating circumstances, it could only be three years. There may even be lenders who may finance you immediately after a foreclosure with a large down payment and high interest rate. The average time is 2 - 5 years. The more you have for a down payment the more likely you are to find a lender to work with you. You may be better off checking with a mortgage broker than a bank, because the broker works with multiple lenders.
Which ever way you decide to go, start rebuilding your credit. Go to a lender and sit down with them and explain what happened and see what they tell you. If they cannot give you a mortgage at that point, at the very least they can guide you so you can work your way towards qualifying for a mortgage.
But keep saving as much money as you can while you work on obtaining a mortgage.
I hope this helps.