Skip to main content
Visitor II
September 21, 2021
Solved

Having issues getting POST (upload file from web browser) to work in an STM32F407 project

  • September 21, 2021
  • 1 reply
  • 1371 views

We have a custom board with an STM32F407 on it. I used CubeMX to create the project and enabled HTTPD. I used the example LwIP_HTTP_Server_Netconn to get a webserver running. I have a few pages working including a dynamic page. Next step was to create a page that would allow the user to Submit a file to upload to the webserver. I used the In Application Programming example for the STM324xG_EVAL board to get ideas on how to do this. The big difference is that it does not use netconn... Everything is fine until I press submit on the page, then the following happens:

  1. If you submit with no file chosen my code detects this and then does a netconn_write of the same page. Then it closes the connection and deletes the netbuf. When this happens I see from Wireshark that the first packet is sent out to refresh the page but it takes 3 packets and the other two never go out to the browser. I then see keepalive requests and responses from the browser and webserver after this.
  2. It gets stuck when you actually submit a file but I haven't really tried to debug this yet.

I am a newbie to LWIP and webservers. I have found it near impossible to find good tutorials on how this stuff works. Any help would be appreciated :grinning_face:

Mike.

    This topic has been closed for replies.
    Best answer by MStra.3

    I figured this out. The code I started with closed the connection after every receipt of data. The connection must be kept open during the entire POST.

    Mike.

    1 reply

    MStra.3AuthorAnswer
    Visitor II
    October 6, 2021

    I figured this out. The code I started with closed the connection after every receipt of data. The connection must be kept open during the entire POST.

    Mike.