This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

RL-TCPnet Webserver: Data Download to Client txt-File

Hi,

I am using the RL-TCPnet Webserver based on the "http_demo" and would like to import and export data into a txt-File on the client pc.

Uploading the data from the client was no problem using the post method to submit the form and process it with the cgi function "cgi_process_data" (as seen in the "http_upload example").

My problem is to export the Data (~1kB) to the Client PC to save it in a txt-File (should be made from the browser).

I am using no file system on the webserver and dont want want to use a tftp server (out of ram and rom).

Shouldn't it be possible to send the Data via HTTP?

I wasn't able to find a library function, nor any examples about this.

Any help would be appreciated!

Thanks in advance,
Mathias

Parents
  • create a "your_data_txt.cgi" file that looks like this:

    c %s
    

    Then in cgi_func output your formatted data. ex:

    
    uint16_t cgi_func (uint8_t *env, uint8_t *buf, uint16_t buflen, uint32_t *pcgi)
    {
        uint32_t len = 0;
        uint8_t id;
        char buffer[5];
    
        len = sprintf((char *)buf,(const char *)&env[0], "your text data");
        return ((uint16_t)len);
    }
    

Reply
  • create a "your_data_txt.cgi" file that looks like this:

    c %s
    

    Then in cgi_func output your formatted data. ex:

    
    uint16_t cgi_func (uint8_t *env, uint8_t *buf, uint16_t buflen, uint32_t *pcgi)
    {
        uint32_t len = 0;
        uint8_t id;
        char buffer[5];
    
        len = sprintf((char *)buf,(const char *)&env[0], "your text data");
        return ((uint16_t)len);
    }
    

Children