文件大小限制
This commit is contained in:
parent
7a75abc22c
commit
0838f59a2e
|
|
@ -814,9 +814,17 @@ const Meeting: React.FC = () => {
|
|||
<Button type="primary" style={{ backgroundColor: '#31353A' }}
|
||||
onClick={() => {
|
||||
const file = document.createElement("input") as any;
|
||||
file.accept = "image/*,.doc,.docx,.ppt,.pptx,.xls,.xlsx,application/pdf";
|
||||
file.type = "file";
|
||||
file.onchange = async () => {
|
||||
const fileInfo = file.files[0];
|
||||
const maxSize = 100 * 1024 * 1024; // 100MB in bytes
|
||||
|
||||
if (fileInfo.size > maxSize) {
|
||||
message.error('文件太大!请上传小于100MB的文件。')
|
||||
// 清除文件输入框的值,以便用户可以选择其他文件
|
||||
return
|
||||
}
|
||||
const fileType = fileInfo.name.split('.');
|
||||
const fileTypeName = fileType[fileType.length - 1];
|
||||
await GetRoomUpFileurl(state.channelId, fileTypeName).then(async res => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue