SQL Server Provider
Store uploaded files directly in a SQL Server database. Configure the connection string and table schema.
What you should see: files stored as rows in SQL Server rather than on disk. Only the server-side provider changes — the browser code is identical. Accepts up to 50 MB.
Drag & drop files here, or paste from clipboard
<core-upload asp-upload-url="/api/upload/upload"
asp-multiple="true"
asp-progress="true"
asp-auto-upload="true"
asp-max-size="50MB">
</core-upload>
<!-- Server-side: store files in SQL Server -->
// In Program.cs
builder.Services.AddCoreUpload(options =>
{
options.UseStorageProvider<SqlServerStorageProvider>(config =>
{
config.ConnectionString =
builder.Configuration.GetConnectionString("Default");
config.TableName = "UploadedFiles";
config.SchemaName = "dbo";
});
});
// Table schema:
// CREATE TABLE dbo.UploadedFiles (
// Id UNIQUEIDENTIFIER PRIMARY KEY DEFAULT NEWID(),
// FileName NVARCHAR(256) NOT NULL,
// ContentType NVARCHAR(128),
// FileSize BIGINT,
// FileData VARBINARY(MAX),
// CreatedAt DATETIME2 DEFAULT GETUTCDATE()
// );