Large file streaming uploads

This commit is contained in:
Shaun Walker
2019-09-06 13:15:18 -04:00
parent 22420f2b43
commit a84eee8782
17 changed files with 305 additions and 13 deletions

View File

@ -0,0 +1,43 @@
@if (multiple)
{
<input type="file" id="@fileid" name="file" accept="@filter" multiple />
}
else
{
<input type="file" id="@fileid" name="file" accept="@filter" />
}
<span id="@progressinfoid"></span> <progress id="@progressbarid" style="visibility: hidden;"></progress>
@code {
[Parameter]
public string Name { get; set; } // optional - can be used for managing multiple file upload controls on a page
[Parameter]
public string Filter { get; set; } // optional - for restricting types of files that can be selected
[Parameter]
public string Multiple { get; set; } // optional - enable multiple file uploads
string fileid = "";
string progressinfoid = "";
string progressbarid = "";
string filter = "*";
bool multiple = false;
protected override void OnInitialized()
{
fileid = Name + "FileInput";
progressinfoid = Name + "ProgressInfo";
progressbarid = Name + "ProgressBar";
if (!string.IsNullOrEmpty(Filter))
{
filter = Filter;
}
if (!string.IsNullOrEmpty(Multiple))
{
multiple = bool.Parse(Multiple);
}
}
}

View File

@ -67,9 +67,9 @@
<table class="table">
<tbody>
<tr>
<td><label for="Username" class="control-label">User: </label></td>
<td style="text-align: right;"><label for="Username" class="control-label">User: </label></td>
<td><input type="text" name="Username" class="form-control" placeholder="Enter Username" @bind="@username" /></td>
<td><button type="button" class="btn btn-primary" @onclick="@AddUser">Add</button></td>
<td style="text-align: left;"><button type="button" class="btn btn-primary" @onclick="@AddUser">Add</button></td>
</tr>
</tbody>
</table>