PostApplicationUpdate example

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

PostApplicationUpdate example

Post by SeeCwriter »

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: 1080
Joined: Thu Apr 24, 2008 3:58 pm

Re: PostApplicationUpdate example

Post by pbreed »

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: 1080
Joined: Thu Apr 24, 2008 3:58 pm

Re: PostApplicationUpdate example

Post by pbreed »

3.X does not have this issue, as it can do streaming recieves.
SeeCwriter
Posts: 605
Joined: Mon May 12, 2008 10:55 am

Re: PostApplicationUpdate example

Post by SeeCwriter »

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