Horje
httppostedfilebase in .net core 3.1 Code Example
httppostedfilebase in .net core 3.1
[HttpPost("UploadFiles")]
public async Task<IActionResult> Post(List<IFormFile> files)
{
    long size = files.Sum(f => f.Length);

    // full path to file in temp location
    var filePath = Path.GetTempFileName();

    foreach (var formFile in files)
    {
        if (formFile.Length > 0)
        {
            using (var stream = new FileStream(filePath, FileMode.Create))
            {
                await formFile.CopyToAsync(stream);
            }
        }
    }

    // process uploaded files
    // Don't rely on or trust the FileName property without validation.

    return Ok(new { count = files.Count, size, filePath});
}




Csharp

Related
unity c# set object tag Code Example unity c# set object tag Code Example
c# return list Code Example c# return list Code Example
c# get all class properties Code Example c# get all class properties Code Example
newtonsoft create dynamic object Code Example newtonsoft create dynamic object Code Example
c# reverse a string Code Example c# reverse a string Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11