UINT32 ImageUpdate_Addr = 0;
This function demonstrates the processing of file uploads. First, the function locates the file data, skipping over any headers that arrive. Second, it reads the file 64 bytes at a time and hashes that data. Once all data has been received, the function calculates the MD5 sum and stores it in curHTTP.data.
After the headers, the first line from the form will be the MIME separator. Following that is more headers about the file, which we discard. After another CRLFCRLF, the file data begins, and we read it 16 bytes at a time and add that to the update. The reading terminates when the separator string is encountered again on its own line. Notice that the actual file data is trashed in this process, allowing us to accept files of arbitrary size, not limited by RAM. Also notice that the data buffer is used as an arbitrary storage array for the result. The ~uploadeImage~ callback reads this data later to send back to the client.
None
Return Values |
Description |
HTTP_IO_DONE |
all parameters have been processed |
HTTP_IO_WAITING |
the function is pausing to continue later |
HTTP_IO_NEED_DATA |
data needed by this function has not yet arrived |