<input type="file" accept="image/*" />
accept表示可以上傳文件類型,image表示圖片,*表示所有支持的格式。(ps:wps不適用,所有還是老老實實截取文件類型。)
if (['xls','xlsx'].indexOf(FileExt.toLowerCase()) === -1){
this.$message.warning('只能上傳.XLS.XLSX格式的文件!');
return false;
}
accept可以指定如下信息:
*.jpeg |
image/jpeg |
JPEG |
*.doc |
application/msword |
MS Word Document |
*.gif |
image/gif |
Graphic Interchange Format |
*.htm |
text/html |
HyperText Markup Language |
*.html |
text/html |
HyperText Markup Language |
*.jpe |
image/jpeg |
JPEG |
*.jpeg |
image/jpeg |
JPEG |
*.jpg |
image/jpeg |
JPEG |
*.mp3 |
audio/mpeg |
MPEG Audio Stream, Layer III |
*.mp4 |
audio/mp4, video/mp4 |
MPEG-4 Audio/Video |
|
application/pdf |
Portable Document Format |
*.png |
image/png |
Portable Network Graphics |
*.ppt |
application/vnd.ms-powerpoint |
MS PowerPoint Presentation |
*.txt |
text/plain |
Plain Text |
*.xls |
application/vnd.ms-excel |
MS Excel Spreadsheet |
*.xml |
text/xml, application/xml |
Extensible Markup Language |
*.zip |
aplication/zip |
Compressed Archive |
*.wps |
application/vnd.ms-works |
Works Text Document |