[Feature][S300][task-view-993][webui] add web upload upgrade package upgrade function
Change-Id: I3772a8a2cb049a242f21fca7a086040581e759ca
diff --git a/lynq/CPE_COMMON/ap/app/cgi/cgi.c b/lynq/CPE_COMMON/ap/app/cgi/cgi.c
index 7583edb..b026367 100755
--- a/lynq/CPE_COMMON/ap/app/cgi/cgi.c
+++ b/lynq/CPE_COMMON/ap/app/cgi/cgi.c
@@ -307,7 +307,7 @@
int main()
{
- const char *source_filename = "/firmware_tmp_file"; // Source file path
+ const char *source_filename = "/tmp/firmware_tmp_file"; // Source file path
const char *target_filename = "/cache/zte_fota/delta.package"; // Target file path
const char *content_length_str = NULL;
int content_length = 0;
@@ -319,6 +319,7 @@
content_length_str = getenv("CONTENT_LENGTH");
if (!content_length_str)
{
+ system("rm -rf /tmp/firmware_tmp_file");
print_json_response(0, "Missing CONTENT_LENGTH environment variable");
return 1;
}
@@ -326,6 +327,7 @@
content_length = atoi(content_length_str);
if (content_length <= 0)
{
+ system("rm -rf /tmp/firmware_tmp_file");
print_json_response(0, "Invalid CONTENT_LENGTH");
return 1;
}
@@ -333,12 +335,14 @@
// Call the file upload handling function
if (handle_file_upload(source_filename, target_filename, content_length) != 0)
{
+ system("rm -rf /tmp/firmware_tmp_file");
print_json_response(0, "File upload failed");
return 1;
}
// Output success information
//print_json_response(1, "File upload successful");
+ system("rm -rf /tmp/firmware_tmp_file");
cgi_fota_update_progress();