The Spanish explorer Francisco de Orellana did it in 1542, so I guess there is no reason why you can't do it today.
http://en.wikipedia.org/wiki/Francisco_de_OrellanaYou start from Coca in Ecuador on the Rio Napo. You will connect with other boats in Iquitos, Peru, Tabatinga and Manaus, Brasil. The whole trip should take anywhere up to a month.
It won't be comfortable as you will have to use local ferries, and these are far removed from cruise ships. The trip will be tiring, crowded, uncomfortable, hot, itchy and as miserable as any trip you will ever go on. Nevertheless, for some reason many tourists of all ages and wallets make it though, simply so they can say they did. Look how decrepit the town of Coca is!
http://www.hobotraveler.com/055tcocacity.shtmlNow you have seen this, I suggest you reconsider the bus option. The Peruvian bus company Ormeno operates very comfortable buses from Quito to Buenos Aires via Lima. This will take about 5 days straight through.
http://www.grupo-ormeno.com.pe/home.phpThen take the Crucero del Norte bus to Rio de Janeiro, about 38 hours.
http://www.crucerodelnorte.com.ar/cn/english/default.aspxTotal cost will be about US$ 200.00.
After all the time and expense of the 7-day bus trip, it may behoove you to consider flying, which won't be cheap, but oh so convenient. Fare about US$ 450.00 one way, plus tax.
.