input上傳文件,前端判斷文件的大小及類型

因爲項目須要,須要實現該功能紀錄以下。html 上傳文件時,由前端判斷文件的大小及類型。舉例說明:要求上傳的文件小於10MB的文件,而且文件類型必須爲.txt類型。關鍵核心代碼以下:前端 html代碼:<input type="file" @change="getFile($event)">this js代碼:htm getFile(event) { console.log(event) /
相關文章
相關標籤/搜索