Issues with File Upload in ASP.NET Core using Blazor

I’m working on a project with separate backend and frontend folders. On the frontend side, I have the following service for uploading files:

public async Task<IEnumerable<FileMetaDataDto>> UploadFileAsync(IList<IBrowserFile> files, Guid projectId, Guid? commentId)

{
using var content = new MultipartFormDataContent();

foreach (var file in files)
{
    var fileContent = new StreamContent(file.OpenReadStream());
    fileContent.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data")
    {
        Name = "files",
        FileName = file.Name,
    };
    
    fileContent.Headers.ContentType = new MediaTypeHeaderValue(file.ContentType);

    content.Add(fileContent);
}

Console.WriteLine($"Check-3 {projectId}, Comment ID: {commentId}, Content: {content}");

var response = await _httpClient.PostAsync($"api/Files/project/{projectId}/upload-multiple?commentId={commentId}", content);
response.EnsureSuccessStatusCode();

return await response.Content.ReadFromJsonAsync<IEnumerable<FileMetaDataDto>>();

}
On the backend side, my controller looks like this:

[HttpPost("project/{projectId}/upload-multiple")]

public async Task UploadMultiple(IEnumerable files, Guid projectId, [FromQuery] Guid? commentId)
{
Console.WriteLine(“Check server side”);
var results = await _fileService.UploadMultipleFilesAsync(files, projectId, commentId);

return Ok(results);

}
When I try to upload files, I get an error after the console log Console.WriteLine($”Check-3 {projectId}, Comment ID: {commentId}, Content: {content}”):

An error occurred while sending the request.

Additionally, I don’t see the console log from the server side.

When I attempt to add multiple files, I receive the following error:

Error: There is no file with ID 1. The file list may have changed. See https://aka.ms/aspnet/blazor-input-file-multiple-selections.
Error: There is no file with ID 1. The file list may have changed. See https://aka.ms/aspnet/blazor-input-file-multiple-selections.
at Ze (https://localhost:55327/_framework/blazor.server.js:1:36968)
at Object.readFileData (https://localhost:55327/_framework/blazor.server.js:1:36894)
at https://localhost:55327/_framework/blazor.server.js:1:3244
at new Promise ()
at y.beginInvokeJSFromDotNet (https://localhost:55327/_framework/blazor.server.js:1:3201)
at Yt._invokeClientMethod (https://localhost:55327/_framework/blazor.server.js:1:60713)
at Yt._processIncomingData (https://localhost:55327/_framework/blazor.server.js:1:58188)
at Yt.connection.onreceive (https://localhost:55327/_framework/blazor.server.js:1:51829)
at s.onmessage (https://localhost:55327/_framework/blazor.server.js:1:79974)

The other endpoints in my project are working correctly.
I have verified the URLs and endpoints to ensure they match.
I’m using Blazor Server for the frontend.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật