When your iOS device is in recovery mode or it's disabled and in password in normal mode, you can use 3uTools "Easy Flash" to flash it with backuping your iPhone data. (This function also supports iPad and iPod Touch.)
The key point is that you must check the box of “Don’t erase user’s data” so that your device can still keep phone data after flash.
However, please note that the iPhone data will be kept only if the flashing process is completed successfully.
For more details about how to operate it, you may view the 3uTools Easy Flash tutorial.