@@ -420,7 +420,7 @@ export class DxcFileInputComponent
420420 this . uploadIdSubscription = this . fileService
421421 . uploadId ( this . requests . uploadIdRequest . url + "/" + fileDetails . name )
422422 . subscribe ( ( uploadResponse : Object ) => {
423- this . uploadId = uploadResponse as any ; //Prakash changes
423+ this . uploadId = uploadResponse as any ;
424424 this . uploadFile ( fileDetails ) ;
425425 } ) ;
426426 }
@@ -467,13 +467,14 @@ export class DxcFileInputComponent
467467 }
468468
469469 uploadtoAPI ( filedata , file , lastChunksize , result ) {
470- lastChunksize = lastChunksize + this . uploadChunkSize ;
471470 this . chunkResult = result ;
472471 if ( result ) {
473472 //Add you logic what do you want after reading the file
474473 this . uploadChunks ( filedata ) ;
474+ lastChunksize = lastChunksize + this . uploadChunkSize ;
475475 this . readFile ( file , lastChunksize , this . uploadtoAPI . bind ( this ) ) ;
476476 }
477+
477478 }
478479
479480 uploadChunkComplete ( fileName , progress ) {
@@ -493,7 +494,7 @@ export class DxcFileInputComponent
493494 // progress.value = 99;
494495 // this.updateProgress(fileName, progress);
495496 // }
496- this . data [ 0 ] . postResponse = response as any //Prakash changes
497+ this . data [ 0 ] . postResponse = response as any
497498 this . data [ this . uniqueFileNameIndex ] . data . uniqueFileName = response as any ;
498499 this . fileEventType = EventType . POSTUPLOAD ;
499500 this . data [ 0 ] . eventType = this . fileEventType ;
@@ -502,7 +503,7 @@ export class DxcFileInputComponent
502503 this . removeChunkFileInfo ( fileName ) ;
503504 progress . status = "success" ;
504505 progress . value = 100 ;
505- this . updateProgress ( fileName , progress , response ) ; //Prakash changes
506+ this . updateProgress ( fileName , progress , response ) ;
506507 } ) ;
507508 }
508509 }
@@ -549,7 +550,7 @@ export class DxcFileInputComponent
549550 value : 0 ,
550551 status : "progress" ,
551552 } ;
552- let postResponse ; //Prakash changes
553+ let postResponse ;
553554 switch ( response . type ) {
554555 case HttpEventType . UploadProgress :
555556 progress . value =
@@ -567,12 +568,12 @@ export class DxcFileInputComponent
567568 if ( response ?. ok ) {
568569 progress . value = 100 ;
569570 progress . status = "success" ;
570- postResponse = response ?. body ; //Prakash changes
571+ postResponse = response ?. body ;
571572 }
572573
573574 break ;
574575 }
575- this . updateProgress ( fileData . name , progress , postResponse ) ; //Prakash changes
576+ this . updateProgress ( fileData . name , progress , postResponse ) ;
576577 } ) ;
577578 const SubscriptionManager = {
578579 fileName : fileData . fileName ,
@@ -826,7 +827,8 @@ export class DxcFileInputComponent
826827
827828 private uploadChunks ( chunkFileDetails : ChunkMetaData ) {
828829 let formParams = new FormData ( ) ;
829- formParams . append ( "file" , chunkFileDetails . file ) ;
830+ let file = new File ( [ chunkFileDetails . file ] , chunkFileDetails . fileName ) ;
831+ formParams . append ( "file" , file ) ;
830832 formParams . append ( "fileName" , chunkFileDetails . fileName ) ;
831833 formParams . append ( "fileSize" , chunkFileDetails . fileSize . toString ( ) ) ;
832834 formParams . append ( "fileType" , chunkFileDetails . fileType ) ;
@@ -835,6 +837,7 @@ export class DxcFileInputComponent
835837 formParams . append ( "uploadId" , this . uploadId ) ;
836838 const headers = new HttpHeaders ( {
837839 "Content-Type" : "multipart/form-data" ,
840+ "X-File-Identifier" : chunkFileDetails . fileName . split ( '.' ) [ 0 ] + "$^$" + chunkFileDetails . chunkNumber + "$^$" + this . uploadId + "." + chunkFileDetails . fileName . split ( '.' ) [ 1 ] ,
838841 } ) ;
839842 const uploadSubscription = this . fileService
840843 . upload ( this . requests . uploadChunkRequest . url , formParams , headers )
@@ -898,7 +901,7 @@ export class DxcFileInputComponent
898901 }
899902 break ;
900903 }
901- this . updateProgress ( chunkFileDetails . fileName , progress , response ?. body ) ; //Prakash changes
904+ this . updateProgress ( chunkFileDetails . fileName , progress , response ?. body ) ;
902905 } ) ;
903906 if (
904907 this . chunkUploadSubscription . filter ( ( Subscription ) => {
@@ -962,7 +965,7 @@ export class DxcFileInputComponent
962965 ( file ?. progress ?. value ?? 0 ) < ( progress ?. value ?? 0 )
963966 ) {
964967 file . progress = progress ;
965- file . postResponse = postResponse ; //Prakash changes
968+ file . postResponse = postResponse ;
966969 }
967970 this . fileAddService . add ( file ) ;
968971 } ) ;
0 commit comments