Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

.net Core Get File Request

public FileResult GetFile(string fileid)
{
   byte[] bytes = File.ReadAllBytes("C:Temp.txt"); 
	return File(bytes, System.Net.Mime.MediaTypeNames.Application.Octet, "Temp.txt");
}
Comment

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

PREVIOUS NEXT
Code Example
Csharp :: change sprite of a sprite unity 
Csharp :: how to get parent gameobject in unity 
Csharp :: c# void 
Csharp :: add object to list c# 
Csharp :: c# remove special characters from string 
Csharp :: copy text from a text box c# 
Csharp :: c# string array to string 
Csharp :: c# string to variable name 
Csharp :: cast int to enum type c# 
Csharp :: return json from controller c# 
Csharp :: c# first item i list 
Csharp :: discord bot in c# 
Csharp :: c# remove double quotes from string 
Csharp :: C# Program For Check Total Occurrence Of A Number In An Array 
Csharp :: c# environment variables 
Csharp :: unit test throw exception c# xunit 
Csharp :: c# 2d list 
Csharp :: c# find largest number in list 
Csharp :: linq where id in list 
Csharp :: rotate player unity 
Csharp :: how to add to a list c# 
Csharp :: ngrok for https 
Csharp :: prevent asp button from postback 
Csharp :: c# check lenght 
Csharp :: string list to object array in c# 
Csharp :: how to add a gameobject 
Csharp :: particle system start color 
Csharp :: how to get specific length of row in matrix c# 
Csharp :: unit test c# exception thrown 
Csharp :: c# datagridview rows clear not working 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =