Skip to content
This repository was archived by the owner on May 5, 2021. It is now read-only.

Commit 251f1b0

Browse files
committed
Added folder upload feature, supported by Chrome, Edge, FireFox (and maybe others)
1 parent 617b655 commit 251f1b0

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

BlazorInputFile/FileListEntryImpl.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ public class FileListEntryImpl : IFileListEntry
2323

2424
public string Type { get; set; }
2525

26+
public string RelativePath { get; set; }
27+
2628
public Stream Data
2729
{
2830
get

BlazorInputFile/wwwroot/inputfile.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
lastModified: new Date(file.lastModified).toISOString(),
1313
name: file.name,
1414
size: file.size,
15-
type: file.type
15+
type: file.type,
16+
relativePath: file.webkitRelativePath
1617
};
1718
elem._blazorFilesById[result.id] = result;
1819

samples/Sample.Core/Pages/MultiFile.razor

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44

55
<p>A multi-file picker that displays information about selection and shows progress as each one is loaded.</p>
66

7-
<InputFile multiple OnChange="HandleSelection" />
7+
<label for="uploadFiles">Select File(s)</label>
8+
<InputFile id="uploadFiles" multiple OnChange="HandleSelection" />
9+
10+
<label for="uploadFolder">Select Folder</label>
11+
<InputFile id="uploadFolder" multiple webkitdirectory OnChange="HandleSelection" />
812

913
@if (selectedFiles != null)
1014
{

0 commit comments

Comments
 (0)