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

Moderator: igrr

User avatar
By Iksi
#78690 Hello,

I want to send a file from the Http Upload directly to an SoftSerial Port. For that purpose I need to know the exact size of the file because before starting to send the file i have to send the size of it.
I think there is nothing in the library to read the exact file size. So i thought about uploading the file twice.
At first upload i want only to check the size of it. Afterwards i want to start a second upload and send it via SoftSerial to an nextion Display.

The first upload is initiated by choosing the file in an file dialog and then pushing a button on the http page.

So how can i start the second upload without klicking any button on the http page ? Should work automatically after the first upload is done.

best regards Iksi
User avatar
By QuickFix
#78700 I don't exactly understand what your goal is, but sending content twice *feels* as a very weird and unnecessary solution to me.
Normally one would use the content-length header value to determine the length, just like one would use content-disposition to get to the filename.
User avatar
By Iksi
#78707 But the content length value gives me a value which is about 200byte larger than the file size I want to upload.
It is not exactly 200 byte larger, it can be 205 or 206.
I need the exact size of the file. So how can I calculate the real file size?
User avatar
By QuickFix
#78710
Iksi wrote:So how can I calculate the real file size?

You have to extract the size of the header again (if I recall correctly, it has been a while).