-->
Page 1 of 3

Changing HTTP_UPLOAD_BUFLEN

PostPosted: Wed Oct 17, 2018 5:17 pm
by Iksi
Hello,

I would like to change the HTTP_UPLOAD_BUFLEN from the ESP8266WebServer.
In the Library ESP8266WebServer.h is the following code:

#ifndef HTTP_UPLOAD_BUFLEN
#define HTTP_UPLOAD_BUFLEN 2048
#endif

So i thougth i can change it by writing
#define HTTP_UPLOAD_BUFLEN 4096
in my sketch before including the library. But it does not work.
I tried then to put the #define statement as first line in the Sketch, then after the #include of the library but nothing works. The value ist always 2048. If i change the value from 2018 to 4096 directly in the library it works of course.

So what am i doing wrong ?

Re: Changing HTTP_UPLOAD_BUFLEN

PostPosted: Thu Oct 18, 2018 3:08 am
by QuickFix
Could you first explain what your goal is? :?
Buffer-length has nothing to do with maximum transferable file size.

Re: Changing HTTP_UPLOAD_BUFLEN

PostPosted: Thu Oct 18, 2018 6:19 am
by Iksi
I want to upload a file directly to an serial port. The hardware I am sending it to expects the file in 4096 byte blocks. So I thought the easiest way to achieve this would be to change the buffer length.

Because there is the ifndef statement I thought it is as easy.

Re: Changing HTTP_UPLOAD_BUFLEN

PostPosted: Thu Oct 18, 2018 7:42 am
by QuickFix
I'm not sure about this, but isn't HTTP_UPLOAD_BUFLEN for the upstream buffer (from ESP to browser), so the other way round?

Anyway: these settings are for the WiFi stack, I wouldn't change them too much myself.
I think it's better you create your own buffer that will spit received data out over serial in the required chunk sizes.