mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-08 15:55:31 +01:00
Merge branch 'dev' into feature-websockets-status
This commit is contained in:
commit
522ada88ea
179 changed files with 5678 additions and 2460 deletions
|
|
@ -16,26 +16,31 @@ export class UploadFileWidgetComponent implements OnInit {
|
|||
}
|
||||
|
||||
public fileOver(event){
|
||||
console.log(event);
|
||||
}
|
||||
|
||||
|
||||
public fileLeave(event){
|
||||
console.log(event);
|
||||
}
|
||||
|
||||
|
||||
public dropped(files: NgxFileDropEntry[]) {
|
||||
for (const droppedFile of files) {
|
||||
if (droppedFile.fileEntry.isFile) {
|
||||
const fileEntry = droppedFile.fileEntry as FileSystemFileEntry;
|
||||
console.log(fileEntry)
|
||||
fileEntry.file((file: File) => {
|
||||
console.log(file)
|
||||
const formData = new FormData()
|
||||
formData.append('document', file, file.name)
|
||||
this.documentService.uploadDocument(formData).subscribe(result => {
|
||||
this.toastService.showInfo("The document has been uploaded and will be processed by the consumer shortly.")
|
||||
this.toastService.showInfo(The document has been uploaded and will be processed by the consumer shortly.")
|
||||
}, error => {
|
||||
this.toastService.showError("An error has occured while uploading the document. Sorry!")
|
||||
switch (error.status) {
|
||||
case 400: {
|
||||
this.toastService.showError(`There was an error while uploading the document: ${error.error.document}`)
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
this.toastService.showError("An error has occured while uploading the document. Sorry!")
|
||||
break;
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue