Open the D-Link web-interface (http://192.168.0.1) in a web browser, Log In, and go to Tools -> Firmware. *Warning: only flash over an Ethernet-cable.
For me (and for another user here on the forum) the "Tools -> Firmware" menu did not exist. I did have a "Management -> Upgrade" menu but through that I was not able to use the "factory-to-ddwrt.bin" image. I kept getting a "Firmware Upgrade failed!" error, even after downgrading. (for more info see http://www.dd-wrt.com/phpBB2/viewtopic.php?t=311973)
I posted on the forum and someone suggested trying it through the recovery mode, and that did the trick. So I'd like to suggest adding that as an alternative way to use the factory-to-ddwrt.bin or to replace the current method with the recovery mode method as it seems that the current method is just incorrect.