You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How to use with async await to upload images because i want to send params to next image returned from 1st request.
post_id returned from 1st request should be sent with all next images.
this is what is am doing but it is not waiting:
dropped(files: NgxFileDropEntry[]) {
this.files = files;
for (const droppedFile of files) {
// Is it a file?
if (droppedFile.fileEntry.isFile) {
const fileEntry = droppedFile.fileEntry as FileSystemFileEntry;
fileEntry.file(async (file: File) => {
// Here you can access the real file
console.log(droppedFile.relativePath, file);
await new Promise((resolve, reject) => {
this.http.uploadImages(file, 'UploadImage', this.postId).subscribe((res: any) => {
if (res.status == true) {
resolve(true);
this.postId = res.data.post_id; // i want to send this ID in next request.
} else {
reject();
console.log(res.message);
}
})
});
});
} else {
// It was a directory (empty directories are added, otherwise only files)
const fileEntry = droppedFile.fileEntry as FileSystemDirectoryEntry;
console.log(droppedFile.relativePath, fileEntry);
}
}
}
The text was updated successfully, but these errors were encountered:
How to use with
async await
to upload images because i want to send params to next image returned from 1st request.post_id
returned from 1st request should be sent with all next images.this is what is am doing but it is not waiting:
The text was updated successfully, but these errors were encountered: