上传文件

This commit is contained in:
2020-11-12 09:53:30 +08:00
parent 84d3e45292
commit 4b83d61df7
4 changed files with 55 additions and 36 deletions

View File

@@ -59,16 +59,19 @@ export function getValue(key: string): any{
* @param name 图片名字
*/
export function provenimg(name: string): boolean{
export function provenimg(file: any): boolean | void{
const type = ['png', 'jpg'];
const ntypearr = name.split('.');
const ntypearr = file.name.split('.');
const ntype = ntypearr[ntypearr.length - 1];
console.log(ntype)
let istype = false
for(const i in type){
if(type[i] == ntype){
return true;
istype = true
}
}
return false;
console.log(istype)
return istype;
}
/**
@@ -76,9 +79,9 @@ export function provenimg(name: string): boolean{
* @param name 图片名字
*/
export function provenvideo(name: string): boolean{
export function provenvideo(file: any): boolean{
const type = ['flv', 'mp4', 'wmv', 'mov', 'avi'];
const ntypearr = name.split('.');
const ntypearr = file.name.split('.');
const ntype = ntypearr[ntypearr.length - 1];
for(const i in type){
if(type[i] == ntype){