Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By Sn4k3r
#64478 I use a good library called ESP8266HTTPUpdateServer. It's very useful for uploading sketch but I have to upload sketch data too. Do you have any experience with it? Any ideas?
I need to have an opportunity for creating .bin file which will containe sketch data and then upload this file using web browser.
User avatar
By Sn4k3r
#64528 Thanks very much.
It's a pity but it does not work. It tries to update sketch but it failed "magic byte" check.
But I understood the idea.
I'll try to fix the code.
Last edited by Sn4k3r on Sun Apr 02, 2017 3:47 pm, edited 1 time in total.
User avatar
By Sn4k3r
#64529 I fixed it!
Code should be:

action='?cmd=0'
action='?cmd=100'

and

_command = _server->arg("cmd").toInt();

should be before

if(!Update.begin(maxSketchSpace, _command)){//start with max available size

Code: Select allconst char* ESP8266HTTPUpdateServer::_serverIndex =
R"(<html><body><form method='POST' action='?cmd=0' enctype='multipart/form-data'>
        <input type='hidden' name='cmd' value='0'>
                   <input type='file' name='update'>
                  <input type='submit' value='Update Flash'>
               </form>
          <form method='POST' action='?cmd=100' enctype='multipart/form-data'>
        <input type='hidden' name='cmd' value='100'>
                  <input type='file' name='update'>
                  <input type='submit' value='Update Spiffs'>
                </form>
          </body></html>)";



Code: Select all_command = _server->arg("cmd").toInt();
      
      if(!Update.begin(maxSketchSpace, _command)){//start with max available size
          if (_serial_output) Update.printError(Serial);
        }