我是kendo ui for angular 2和web api(.net core)。我无法使用kendo上传将文件上传到web api。角2的Kendo UI上传组件 - 无法上传
这里是我的示例代码: HTML:
<kendo-upload [saveUrl]="uploadSaveUrl"
[removeUrl]="uploadRemoveUrl"
(upload)="uploadEventHandler($event)">
</kendo-upload>
上传事件处理
uploadEventHandler(e: UploadEvent)
{
this.fs.uploadFile(e.files).subscribe(result => { console.log('result', result); });
}
上传服务:
uploadFile(file: any)
{
const baseUrl = this.basePath + '/api/Common/UploadFile';
return this.dah.post(baseUrl, file);
}
的Web API:
[HttpPost("UploadFile")]
public string UploadFile(IList<IFormFile> files)
{
return "";
}
在这里,我不能在API的文件列表。有没有工作代码?
我们如何发送其他参数,如让我们说applicationId。因此,当我们为它创建一个记录时,我们可以将该文件与该applicationId关联起来? –
看到我发送其他参数 e.data = { attachmentType:this.typList.filter(x => x.Uid == e.files [0] .uid)[0] .type }; // attachmentType is formdata Receiving: - string _property = System.Web.HttpContext.Current.Request.Form [“attachmentType”]; // C# –