Get file name from input type file Angular2

后端 未结 6 1201
既然无缘
既然无缘 2021-02-19 08:33

I want get the file name from my html input tag in a modal view and save it using Angular2. Can someone help me?

6条回答
  •  北恋
    北恋 (楼主)
    2021-02-19 08:55

    You can do next:

    HTML:

    
    

    TypeScript:

    fileEvent(fileInput: Event){
        let file = fileInput.target.files[0];
        let fileName = file.name;
    }
    

提交回复
热议问题