razor pages

Story of File Uploading in ASP.NET Core (Part III - Streaming Files)

We must consider saving files in byte[] formats unless it is absolute necessary, because over the time it can affect the performance of any data storage system. With that being said, streaming can be a good idea in this scenario. We can configure a static files folder for storing the uploaded files. However, this part is optional. You can simply use the web root folder wwwroot instead. But let's just see how to create a separate static files folder on the content root and use it to serve the uploaded…

Keep reading

Story of File Uploading in ASP.NET Core (Part I - MVC/Razor Pages)

The built-in IFormFile interface can be used to represent a file sent via some http request on the ASP.NET Core server side. Following is the skeleton of IFormFile: public interface IFormFile { // Gets the raw Content-Type header of the uploaded file. string ContentType { get; } // Gets the raw Content-Disposition header of the uploaded file. string ContentDisposition { get; } // Gets the header dictionary of the uploaded file. IHeaderDictionary Headers { get; } // Gets the file length in bytes. long Length { get; } // Gets the name from the Content-Disposition header. string Name { get; } // Gets the file name…

Keep reading