Download Manual - MicroProcessor Engineering Ltd.
Transcript
Chapter 40: POST handlers and HTTP updates 149 : ProcessPart \ -- flag After receiving a boundary, process a part up to and including the next boundary, returning true if it is the last one. : ProcessParts \ -Read the parts up to the last boundary 40.5 File update handler : doNewApp \ caddr len -This is the handler for the update request. ’ doNewApp xtPage: /NewApp.asp Defines the page which performs the upload. : .UploadDone \ -Used in the body of an ASP page to indicate the response to the upload. MemPage: /Reflash.htm %IPSTACK%\TestPages\Reflash.htm A form used to request a new application. MemPage: /nareply.asp %IPSTACK%\TestPages\nareply.asp The response delivered after an upload. 40.5.1 Example for pages stored in files This example can be used to upload binary files, e.g. a new application image, to the file system. In order to compile this code the FAT file system must be present, and the equate FilePages? (used in Pages.fth } must be set non-zero. Defer InitUpd \ caddr len -Initialise the app’s binary update system. The input string is the file name to be received. This is passed for validation purposes and in case the file is saved in a local file system. Defer AddUpd \ caddr len -Add the given memory block to the update. All blocks except the last contain /FlashBlock bytes of data. Defer TermUpd \ -Terminate the app’s binary update system. create FileDir$ \ -- addr The base directory for files. This will be prepended to the page name given to InitUpd. The string is held as a counted string in the buffer. Make sure that your application sets FileDir$ to point to its own pages. The directory name must not end in a separator. The directory must exist before use. -1 value hPostFile \ -- handle Handle of the file used to save the download data. : InitFileUpd \ caddr len -Initialise the file reception. : AddFileUpd \ caddr len -Add the given memory block to the update. All blocks except the last contain /FlashBlock bytes of data. : TermFileUpd \ -Terminate the app’s binary file update system.