EEPROM Implementation using OTA

I want to write large data into EEPROM(4KB), using OTA.

Please tell me how to do.

What issue are you experiencing with your code?

I am having an application code, where it is to be written to Flash portion using EEPROM of the controller ATMEGA2560.

For this I have to use OTA also to update the firmware.

In relation to this please give the flow of writing the code to flash of Micro-controller.

This structure would work:

while(sketch.available()){

  write_to_flash( sketch.read() );
  delay(10);
}