Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

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});
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: unique items in list c# 
Csharp :: c# datagridview column size 
Csharp :: https port 
Csharp :: unity create gameobject 
Csharp :: c# sqlite query 
Csharp :: c# number in range 
Csharp :: how to change a string variables value c# 
Csharp :: create material unity script 
Csharp :: how to use distinct in linq query in c# 
Csharp :: c# create array 
Csharp :: copy text from a text box c# 
Csharp :: unity joystick movement 2d 
Csharp :: console.writeline c# 
Csharp :: blazor onchange event not firing with inputselect 
Csharp :: Unity Rigidbody how to set zero momentum 
Csharp :: c# textbox numbers only 
Csharp :: csharp sleep code 1 second 
Csharp :: unity debug c# code with console 
Csharp :: c# latex 
Csharp :: how to save datagridview data to database in c# windows application 
Csharp :: unity set mouse 
Csharp :: C# get md5 of file 
Csharp :: get device connected to player input unity 
Csharp :: list clone - C# 
Csharp :: can you have multiple statement in a case c# 
Csharp :: unity new vector3 
Csharp :: camera follow script car unity 
Csharp :: play animation through script unity 
Csharp :: instantiate unity in parent 
Csharp :: how to rotate object in unity only on one axis 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =