Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebServer.h: totalSize in HTTPUpload struct not report the correct total size of the uploading file. #9602

Open
1 task done
hash6iron opened this issue May 7, 2024 · 0 comments
Labels
Status: Awaiting triage Issue is waiting for triage

Comments

@hash6iron
Copy link

Board

ESP32 Dev Module

Device Description

Audiokit

Hardware Configuration

Not relevant

Version

v2.0.0

IDE Name

PlatformIO

Operating System

Windows 11

Flash frequency

80MHz

PSRAM enabled

yes

Upload speed

921600

Description

The parameter totalSize in HTTPUpload struct not report the total size of the uploading file, this get the currentSize value, then is not possible to calculate for example progress %.

Sketch

void onOTAProgress(size_t current, size_t final) 
{
  // Log every 1 second
  if (millis() - ota_progress_millis > 250) 
  {
      ota_progress_millis = millis();

      if(!pageScreenIsShown)
      {
        hmi.writeString("page screen");
        //hmi.writeString("screen.updateBar.bco=23275");     
        pageScreenIsShown = true;
      }

      HTTPUpload &upload = server.upload();
      size_t fileSize = upload.totalSize / 1024;
      int progressPer = (upload.currentSize / upload.totalSize) * 100;
      fileSize = (round(fileSize*10)) / 10;

      String fileName = upload.filename;

      hmi.writeString("statusLCD.txt=\"FIRMWARE UPDATING " + String(fileSize) + " KB\""); 

      // if(final!=0)
      // {
      //   hmi.writeString("screen.updateBar.val=" + String((current * 100) / final));    
      // }
      
  }
}

Debug Message

Not error appears.

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@hash6iron hash6iron added the Status: Awaiting triage Issue is waiting for triage label May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Awaiting triage Issue is waiting for triage
Projects
None yet
Development

No branches or pull requests

1 participant