我想以离子方式上传文件。我按照此链接 - https://www.youtube.com/watch?v=3f0oLzDazS0 但我想通过PHP上传文件。我怎么能调用php文件。请指教。
html代码
<button ion-button (click)="choose()">Upload</button>
ts代码
choose()
{
this.filechooser.open().then((uri) => {
alert(uri);
this.file.resolveLocalFilesystemUrl(uri).then((newUrl) =>{
alert(JSON.stringify(newUrl));
let dirPath = newUrl.nativeURL;
let dirPathSegments = dirPath.split('/');
dirPathSegments.pop();
dirPath = dirPathSegments.join('/');
this.file.readAsArrayBuffer(dirPath,newUrl.name).then((buffer =>{
this.upload(buffer,newUrl.name);
}));
});
});
}
upload(buffer , name)
{ }
答案 0 :(得分:0)