<FileUpload CustomSuccessMessage="Your file uploaded successfully." OnChange="OnFileUploaded"
OnReset="OnReset" ResetButtonClassName="localbutton"
ShowStatus="false" PartialGuidLength="10" MaxFileSize=@UploadLimit FilterByExtension="true"
ShowCustomButton="true" ButtonText="Start" CustomButtonClassName="startbutton"
AllowedExtensions=".jpg;.png;" ShowResetButton="false"
CustomExtensionMessage="Only .jpg and .png files are allowed."
AppendPartialGuid="true" InputFileClassName="customfileupload"
FileTooLargeMessage=@FileTooLargeMessage>
</FileUpload>
[Parameter] public EventCallback<string> OnReset { get; set; }
在我的CSS中,我像这样隐藏输入文件,它在Edge上不起作用,在它上起作用:
这是CustomButtonClassName,它使用我的开始图像:
CustomButtonClassName="startbutton"
.startbutton
{
position: fixed;
background-color: transparent;
border: 0px;
outline: none;
background-image: url('../images/StartButton.png');
background-repeat: no-repeat;
top: 36vh;
left: 50%;
width: 28%;
height: 28%;
background-size: 100%;
margin-left: -14%;
cursor: pointer;
}
.customfileupload
{
display: inline-block;
cursor: pointer;
height:48px;
min-height: 48px;
visibility: hidden;
display: none;
position: fixed;
left: 0px;
top: 0px;
}
input[type=file], /* FF, IE7+, chrome (except button) */
input[type=file]::-webkit-file-upload-button
{
cursor: pointer;
display: none;
visibility: hidden;
}
完整的源代码和示例项目如有帮助,请参阅:
https://github.com/DataJuggler/BlazorFileUpload
努杰:DataJuggler.Blazor.FileUpload文件上传