所以1.我仍然无法点击上传,看到我的图片将进入我的firebase
这是我的 update.service.ts
@Injectable()
export class UploadService {
constructor(private httpClient: HttpClient) {}
upload(selectedFiles) {
const formData = new FormData();
for (const file of selectedFiles){
formData.append('files', file);
}
this.httpClient
.post('https://imagestoragebackend.firebaseio.com/', formData, {
observe: 'events',
reportProgress: true
})
.subscribe(
success => console.log(success),
error => console.log(error),
)
}
}
上传图片
<input #fileSelect type="file" (change)="selectedFiles = fileSelect.files" multiple>
<button [disabled]="!selectedFiles" (click)="uploadService.upload(selectedFiles)">Upload</button>
但实际上无法上传。然后超出这个范围,我希望看到我上传文件的进度!非常感谢!!