diff --git a/BlazorInputFile/InputFile.razor b/BlazorInputFile/InputFile.razor
index 0b37811..b981a2e 100644
--- a/BlazorInputFile/InputFile.razor
+++ b/BlazorInputFile/InputFile.razor
@@ -1,7 +1,14 @@
@implements IDisposable
@inject IJSRuntime JSRuntime
-
+@if (IsElementHidden)
+{
+
+}
+else
+{
+
+}
@code {
[Parameter(CaptureUnmatchedValues = true)] public Dictionary UnmatchedParameters { get; set; }
@@ -9,6 +16,10 @@
[Parameter] public int MaxMessageSize { get; set; } = 20 * 1024; // TODO: Use SignalR default
[Parameter] public int MaxBufferSize { get; set; } = 1024 * 1024;
+
+ [Parameter] public string ElementId { get; set; } // this id is used by the js function 'wrapInput' which calls click()
+ [Parameter] public bool IsElementHidden { get; set; } = false;
+
ElementReference inputFileElement;
IDisposable thisReference;
diff --git a/BlazorInputFile/wwwroot/inputfile.js b/BlazorInputFile/wwwroot/inputfile.js
index 13e7ab3..a714a6b 100644
--- a/BlazorInputFile/wwwroot/inputfile.js
+++ b/BlazorInputFile/wwwroot/inputfile.js
@@ -63,6 +63,10 @@
destinationUint8Array.set(sourceUint8Array, destinationOffset);
return bytesToRead;
+ },
+
+ wrapInput: function wrapInput(elementId) {
+ document.getElementById(elementId).click();
}
};