在angular 2应用程序中使用angular材质的文件上载选项

在angular 2应用程序中使用angular材质的文件上载选项,angular,Angular,在这里,我试图创造形式。在一个按钮上,我需要上传一些文件。 但不知道如何上传文件使用角2材料。 请任何人提出建议 我的密码是 <table> <tr> <p-fileUpload name="myfile[]" url="./upload.php"></p-fileUpload> </tr> <tr> <mat-checkbox>Ignore Errors</mat-checkbox> </tr

在这里,我试图创造形式。在一个按钮上,我需要上传一些文件。 但不知道如何上传文件使用角2材料。 请任何人提出建议

我的密码是

<table>
<tr>
<p-fileUpload name="myfile[]" url="./upload.php"></p-fileUpload>
</tr>
<tr>
<mat-checkbox>Ignore Errors</mat-checkbox>
</tr>
<tr>
<td>
<button mat-raised-button color="accent">Upload</button>
</td>
<td>
<button mat-raised-button color="accent" (click)="dialogRef.close()" >Cancel</button>
</td>
</tr>
</table>

忽略错误
上传
取消
这样做:

<input name="file" type="file" class="inputfile" (change)="onFileChange($event)"/>


然后您可以在.ts文件的onFileChange函数中处理上载的文件…

请添加您在尝试实现文件上载功能时编写的代码。