Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By Iksi
#78689 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 ?
User avatar
By QuickFix
#78701 Could you first explain what your goal is? :?
Buffer-length has nothing to do with maximum transferable file size.
User avatar
By Iksi
#78708 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.
User avatar
By QuickFix
#78709 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.