Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

.net Core Get File Request

using System.IO;
var filePath = Path.GetTempFileName();
foreach (var formFile in Request.Form.Files)
{
   if (formFile.Length > 0)
   {
      using (var inputStream = new FileStream(filePath, FileMode.Create))
      {
         // read file to stream
         await formFile.CopyToAsync(inputStream);
         // stream to byte array
         byte[] array = new byte[inputStream.Length];
         inputStream.Seek(0, SeekOrigin.Begin);
         inputStream.Read(array, 0, array.Length);
         // get file name
         string fName = formFile.FileName;
      }
   }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Core #Get #File #Request
ADD COMMENT
Topic
Name
8+2 =