PostApplicationUpdate example

Discussion to talk about software related topics only.
Post Reply
SeeCwriter
Posts: 458
Joined: Mon May 12, 2008 10:55 am

PostApplicationUpdate example

Post by SeeCwriter » Thu Jul 29, 2021 10:27 am

I built the PostApplicationUpdate example program for a NANO, and it works. But when I incorporate it into my application, it fails. One problem is that callback function SpecialFileReader never gets called.
Powerup init includes this:

Code: Select all

  if ( EnableMultiPartForms( 5000000 ) ) // enable get the file over webpage.
    {
    RegisterSpecialLongFile("fw", SpecialFileReader); // register a callback function to read the update fw.
    }
I'm using the same webpage as the example, with just the name changed. When I open the webpage, select the s19 file, and click the update button, I get two error messages.
"File did not upload correctly"
"Stream update failure"

The file size argument of EnableMultiPartForms is confusing. In the example it's set to 10k, but the s19 file size is 356k. My app is 4.4M. So I'm not sure what that means. I don't think this is the problem, since the upload fails regardless of the value.

At the top of my post handler is this:

Code: Select all

  if ( httpstricmp(url+1,"FWUPLOAD.HTM") == 1 )
    {
    #ifdef _DEBUG_SECURE_REPRO
    puts( "FW Reprog" );
    #endif
    reprogram(sock, url, data, rxbuf);
    return 0;
    }
And it does make it inside the if statement. The function reprogram is the same function MyDoPost in the example.

What did I miss?

I'm using v2.9.5 of the tools.

User avatar
pbreed
Posts: 973
Joined: Thu Apr 24, 2008 3:58 pm

Re: PostApplicationUpdate example

Post by pbreed » Fri Jul 30, 2021 8:05 pm

2.9.5 CAN NOT receive any posted file larger than the size set in SetMultiPartForms.
Make sure the S19 you are posting is at least 10K smaller than this value.

User avatar
pbreed
Posts: 973
Joined: Thu Apr 24, 2008 3:58 pm

Re: PostApplicationUpdate example

Post by pbreed » Fri Jul 30, 2021 8:05 pm

3.X does not have this issue, as it can do streaming recieves.

SeeCwriter
Posts: 458
Joined: Mon May 12, 2008 10:55 am

Re: PostApplicationUpdate example

Post by SeeCwriter » Mon Aug 02, 2021 9:19 am

The problem was that I was registering the callback function before I started the HTTP task.

Post Reply