If you're seeing the error message 1004 when you are trying to upgrade your iPhone to the new iOS 4.0.1 upgrade, then don't panic. We have done some homework here at PC Advisor and we have found a simple solution to get your iPhone working as good as new again.
The reason that you are getting the error message in the first place is because you have probably been fiddling with the iPhone's setting or have tried to jailbreak your iPhone. If that's the case then all you need to to is reset all of your jailbreak settings back to the way they were when you first got your iPhone. Or what we'd recommend if you want to keep your settings the way they are, is that you kick your iPhone out of Recovery Mode (also known as DFU) using a simple program called RecBoot.
Once you have downloaded RecBoot all you have to do is run the program (while your phone is connected to your computer via the USB wire) and press Exit Recovery Mode. After you have done this, you're iPhone will start up with the new iOS version.
If you don't want to download RecBoot you can exit Recovery Mode simply by unplugging your USB lead and pressing and holding the Home button for 10-seconds, this will exit Recovery Mode, but will all restore your iPhone to your previous iOS. If you want the new iOS then we suggest you download RecBoot.
If you want to re-jailbreak your iPhone with the iOS 4.1 update see: iPhone iOS 4.1 update can still be jailbroken