logo Enterprise-level component library based on Bootstrap and Blazor
gitee
oscs
version
license
download
repo
commit
build
coverage

Upload

Upload the file by clicking

If you edit too much content, signalR communication interruption may be triggered. Please adjust the HubOptions configuration.

builder.Services.Configure<HubOptions>(option => option.MaximumReceiveMessageSize = null);

The InputUpload component is used with other form components to display the file name, select the file and upload it by clicking the browse button, and by setting the ShowRemoveButton parameter, display the delete button, click the delete button to call back onDelete delegate method

Demo

Use the file upload component to constrain the file format within the form

Demo
  • Using the ValidateForm form component, custom validation is set by setting the fileValidation label of the model properties to support file extensionsizevalidation, in this case with the extension .png .jpg .jpeg and the file size limit to 50K
  • After selecting the file and not starting to upload the file, click the submit button to verify that the data is legitimate, and then upload the file OnSubmit callback delegate, noting that the Pictureproperty type is IBrowserFile

The ButtonUpload components, classic styles, user click button to pop up the file selection box.

Demo

Click on the browse button select file upload, in this case set IsMultiple-true multiple-selectable file can be uploaded

When you set up IsSingle, you can upload only one image or file

Set ShowUploadList value to false as normal button

Use DefaultFileList to set up uploaded content

Demo
Test.xls (0 B)
Test.doc (0 B)
Test.ppt (0 B)
Test.mp3 (0 B)
Test.mp4 (0 B)
Test.pdf (0 B)
Test.cs (0 B)
Test.zip (0 B)
Test.txt (0 B)
Test.dat (0 B)

Use DefaultFileList to set up uploaded content

Demo

AvatarUpload component, using the OnChange to limit the format and size of images uploaded by users. In this example, only jpg/png/bmp/jpeg/gif five picture formats are allowed

Demo

Card form avatar box

Round avatar frame

When you set up IsSingle, you can upload only one image or file

RELATED: [Accept] [Media Types]

Set the preview address PrevUrl with the DefaultFileList property

Verify that an example of using a picture box is used in the form

CardUpload components and rendered in card-style band preview mode

Demo

SSR mode
Server Side mode, you can use the IWebHostEnvironment injection service to get to the wwwroot directory and save the file to the images/uploader, which does not require a direct call the controller secondary of MVCSaveToFile method
Wasm mode
It wasn't available in wasm mode, IWebHostEnvironment needed to save files to the server side by calling webapi interface, and so on
Interested students can view their knowledge of Upload components through the wiki in the open source repository related resources of the [The portal]
In this example, server-side verification prompts the file for too much prompt when the file size exceeds 200MB

In this example, the ShowProgress=true display upload progress bar

When you set up IsSingle, you can upload only one image or file

Icons are displayed in different file formats

Demo
.xls
Test.xls (0 B)
.doc
Test.doc (0 B)
.ppt
Test.ppt (0 B)
.mp3
Test.mp3 (0 B)
.mp4
Test.mp4 (0 B)
.pdf
Test.pdf (0 B)
.cs
Test.cs (0 B)
.zip
Test.zip (0 B)
.txt
Test.txt (0 B)
.dat
Test.dat (0 B)

By setting the IconTemplate parameter and using the FileIcon component, you can further customize the file icon [FileIcon example]

Demo
.xls
Test.xls (0 B)
.doc
Test.doc (0 B)
.ppt
Test.ppt (0 B)
.mp3
Test.mp3 (0 B)
.mp4
Test.mp4 (0 B)
.pdf
Test.pdf (0 B)
.cs
Test.cs (0 B)
.zip
Test.zip (0 B)
.txt
Test.txt (0 B)
.dat
Test.dat (0 B)

use data:image/xxx;base64,XXXXX format data string as PrevUrl value

Demo
prevUrl
Test (0 B)

InputUpload

Loading...

ButtonUpload/CardUpload

Loading...

AvatarUpload

Loading...

B station related video link

交流群

QQ Group:BootstrapAdmin & Blazor 795206915 675147445 Welcome to join the group discussion
img
Themes
Bootstrap
Motronic
Ant Design (完善中)
DevUI (制作中)
LayUI (完善中)
An error has occurred. This application may no longer respond until reloaded. Reload
Seems like the connection with the server has been lost. It can be due to poor or broken network. Please hang on while we're trying to reconnect...
Oh snap! Failed to reconnect with the server. This is typically caused by a longer network outage, or if the server has been taken down. You can try to reconnect, but if that does not work, you need to reload the page.
Oh man! The server rejected the attempt to reconnect. The only option now is to reload the page, but be prepared that it won't work, since this is typically caused by a failure on the server.
Bootstrap Blazor Component library updated to 7.4.4-beta01

Bootstrap Blazor at present has more than 120 components. This component is based on Bootstrap Blazor An enterprise-level component library that provides several types of common components such as layout, navigation, form, data, notification, icon, voice, etc. Each component has been carefully designed with modularity, responsiveness and excellent performance. Starting from more practical scenarios, meeting the needs of various scenarios, greatly reducing the time cost of developers, greatly shortening the development cycle, greatly improving development efficiency, and providing a set of General Rights Management System Example project。Bootstrap Blazor Products are maintained by a professional full-time technical team, with efficient response speed, diversified solutions, long-term support, and enterprise-level support. At present, it has been used in many well-known state-owned enterprises, and the project is running stably with a maximum of 1200 people online. On the right is the QR code of the Chinese Blazor QQ community with the largest number of people in China, welcome to scan and join the group.

component updated to 6.6.0 Change log [portal] If the component brings you convenience, please help to light up the project Star github gitee

QQGroup
QQ 795206915