简体   繁体   English

angular6+electron,如何在一台电脑上获取上传文件路径?

[英]angular6+electron, how to get upload file path, in one computer?

we project using angular6 and electron.我们使用 angular6 和电子进行投影。 I want to add a button to xxx.html, and click the button will choose one upload file, how can I get the file path?我想在xxx.html中添加一个按钮,点击按钮会选择一个上传文件,如何获取文件路径?

thanks...谢谢...

I got it, html:我明白了,html:

<input #selectFile type="file" (change)="getPath()"/>

ts: ts:

import {Component, OnInit, ViewChild} from '@angular/core';

@ViewChild("selectFile") selectFile;

let path = this.selectFile.nativeElement.files[0].path;

now, the PATH is my wanted.现在,PATH 是我想要的。

In browser,PATH is fakepath.在浏览器中,PATH 是假路径。 In electron, PATH is realpath.在电子中,PATH 是 realpath。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM