Skip to content

Commit

Permalink
Commit SyncfusionExamples#2: Made changes to handle size limits of 4GB
Browse files Browse the repository at this point in the history
  • Loading branch information
surendrakoritalanewsignature committed Jul 15, 2020
1 parent bcaa505 commit 4870bdb
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 21 deletions.
4 changes: 3 additions & 1 deletion Controllers/AzureProviderController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public AzureProviderController(IHostingEnvironment hostingEnvironment)
{
this.operation = new AzureFileProvider();
// Create a storage account in azure, modify storage name, key,
this.operation.RegisterAzure("samplestorageaccount10", "HDTtipcpTx44LAKfnnWon1bhFZfZVpE6Vt5ToWihBPOgPmKOPkayd+i902eCm3V2Ms1dEi2df4JuKrrdbSoXOw==", "files");
this.operation.RegisterAzure("samplestorageaccount10", "QMdPLhIgZGRaHh3uHmIfEnGl/Qq+QWRtisvrZkQZcVlvdU/Gn4AKBMYZ0Uj1g04qrb/fMWxX3extH3ljTBIJNw==", "files");
this.operation.SetBlobContainer("https://samplestorageaccount10.blob.core.windows.net/files/", "https://samplestorageaccount10.blob.core.windows.net/files/Files");
//----------
//For example
Expand All @@ -29,6 +29,8 @@ public AzureProviderController(IHostingEnvironment hostingEnvironment)
//---------
}
[Route("AzureFileOperations")]
[RequestFormLimits(MultipartBodyLengthLimit = 4294967270)]
[RequestSizeLimit(4294967270)]
public object AzureFileOperations([FromBody] FileManagerDirectoryContent args)
{
if (args.Path != "")
Expand Down
14 changes: 7 additions & 7 deletions Models/AzureFileProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -470,18 +470,18 @@ protected async Task<FileManagerResponse> UploadAsync(IEnumerable<IFormFile> fil
string absoluteFilePath = Path.Combine(Path.GetTempPath(), fileName);
if (action == "save")
{
if (!File.Exists(absoluteFilePath))
{
//if (!File.Exists(absoluteFilePath))
//{
using (FileStream fs = File.Create(absoluteFilePath))
{
await blockBlob.UploadFromStreamAsync(file.OpenReadStream());
fs.Flush();
}
}
else
{
existFiles.Add(fileName);
}
//}
//else
//{
// existFiles.Add(fileName);
//}
}
else if (action == "delete")
{
Expand Down
5 changes: 5 additions & 0 deletions Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
Expand Down Expand Up @@ -36,6 +37,10 @@ public void ConfigureServices(IServiceCollection services)
.AllowAnyHeader();
});
});
services.Configure<FormOptions>(x =>
{
x.MultipartBodyLengthLimit = 4294967270;
});
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
Expand Down
27 changes: 14 additions & 13 deletions web.config
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824"></requestLimits>
</requestFiltering>
</security>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" arguments="%LAUNCHER_ARGS%" />
</system.webServer>
</configuration>
<!--ProjectGuid: D2F1360E-DF8C-4AD2-A8CC-942A180D6762-->
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="4294967270"></requestLimits>
</requestFiltering>
</security>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" arguments="%LAUNCHER_ARGS%">
<environmentVariables />
</aspNetCore>
</system.webServer>
</configuration>

0 comments on commit 4870bdb

Please sign in to comment.