Skip to content

Instantly share code, notes, and snippets.

View DmitrySikorsky's full-sized avatar

Dmitry Sikorsky DmitrySikorsky

View GitHub Profile
[HttpPost]
public async Task<IActionResult> Index(IList<IFormFile> files)
{
foreach (IFormFile source in files)
{
string filename = ContentDispositionHeaderValue.Parse(source.ContentDisposition).FileName.Trim('"');
filename = this.EnsureCorrectFilename(filename);
using (FileStream output = System.IO.File.Create(this.GetPathAndFilename(filename)))
function uploadFiles(inputId) {
var input = document.getElementById(inputId);
var files = input.files;
var formData = new FormData();
for (var i = 0; i != files.length; i++) {
formData.append("files", files[i]);
}
startUpdatingProgressIndicator();
[HttpPost]
public async Task<IActionResult> Index(IList<IFormFile> files)
{
Startup.Progress = 0;
long totalBytes = files.Sum(f => f.Length);
foreach (IFormFile source in files)
{
string filename = ContentDispositionHeaderValue.Parse(source.ContentDisposition).FileName.Trim('"');
"dependencies": {
"ExtCore.WebApplication": "1.1.0",
"Microsoft.AspNetCore.Diagnostics": "1.1.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.1.0"
},
public Startup(IServiceProvider serviceProvider)
: base(serviceProvider)
{
this.serviceProvider.GetService<ILoggerFactory>().AddConsole();
}
public class Extension : ExtensionBase
{
public override string Name
{
get
{
return "Some useful module";
}
}
}
"dependencies": {
"ExtCore.Infrastructure": "1.1.0"
}
public override void Configure(IApplicationBuilder applicationBuilder)
{
if (this.serviceProvider.GetService<IHostingEnvironment>().IsDevelopment())
{
applicationBuilder.UseDeveloperExceptionPage();
applicationBuilder.UseBrowserLink();
}
base.Configure(applicationBuilder);
applicationBuilder.Run(async (context) =>
public interface IToolbar
{
IEnumerable<Button> Buttons { get; }
int Position { get; }
}
public class Button
{
public string Name { get; }
public int Position { get; }
public Button(string name, int position)
{
this.Name = name;
this.Position = position;
}