item.isError is always true but confused what is exact error and also file is not being uploaded #1093

Closed
opened 2019-05-29 11:17:44 +00:00 by NikhilGangurde · 2 comments
NikhilGangurde commented 2019-05-29 11:17:44 +00:00 (Migrated from github.com)

here is my code
public uploader:FileUploader = new FileUploader({url: URL,
headers: [{name:'Accept', value:'application/json'}],
disableMultipart:true,autoUpload:false});

this.uploader.onAfterAddingFile = (file) => {
  console.log('***** onAfterAddingFile ******')
  console.log('file ', file)
}

this.uploader.onAfterAddingFile = (item => {
  item.withCredentials = false;
});

this.uploader.onCompleteItem =  (item:any, response:any, status:any, headers:any) => {
  console.log('ImageUpload:uploaded:',item,item.isError);
};
this.uploader.onCompleteItem = (item:any, response:any, status:any, headers:any) => {
  console.log("Item uploaded successfully" + response);
  };
this.uploader.onErrorItem = (item: FileItem, response: string, status: number, headers: ParsedResponseHeaders)=>{
  console.log(item, response, status, headers);
}
this.uploader._onErrorItem = (item: FileItem, response: string, status: number, headers: ParsedResponseHeaders)=>{
  item._onError(response, status, headers);
  console.log(response, status, headers)
  // this.onErrorItem(item, response, status, headers);
}

and I am getting the following response

Object { url: "http://localhost/softwebitech-CodeIgniter/index.php/fileupload", headers: [], withCredentials: false, formData: [], isReady: false, isUploading: false, isUploaded: true, isSuccess: false, isCancel: false, isError: true, … }

and I am using CodeIgniter upload for api

here is my code public uploader:FileUploader = new FileUploader({url: URL, headers: [{name:'Accept', value:'application/json'}], disableMultipart:true,autoUpload:false}); this.uploader.onAfterAddingFile = (file) => { console.log('***** onAfterAddingFile ******') console.log('file ', file) } this.uploader.onAfterAddingFile = (item => { item.withCredentials = false; }); this.uploader.onCompleteItem = (item:any, response:any, status:any, headers:any) => { console.log('ImageUpload:uploaded:',item,item.isError); }; this.uploader.onCompleteItem = (item:any, response:any, status:any, headers:any) => { console.log("Item uploaded successfully" + response); }; this.uploader.onErrorItem = (item: FileItem, response: string, status: number, headers: ParsedResponseHeaders)=>{ console.log(item, response, status, headers); } this.uploader._onErrorItem = (item: FileItem, response: string, status: number, headers: ParsedResponseHeaders)=>{ item._onError(response, status, headers); console.log(response, status, headers) // this.onErrorItem(item, response, status, headers); } and I am getting the following response Object { url: "http://localhost/softwebitech-CodeIgniter/index.php/fileupload", headers: [], withCredentials: false, formData: [], isReady: false, isUploading: false, isUploaded: true, isSuccess: false, isCancel: false, isError: true, … } and I am using CodeIgniter upload for api
pedrollanes commented 2021-01-13 00:31:15 +00:00 (Migrated from github.com)

I have same problem. I'm using angular 6. How did you fix it?

I have same problem. I'm using angular 6. How did you fix it?
RahulChouhan96 commented 2021-02-25 10:07:16 +00:00 (Migrated from github.com)

I am also facing the same issue. I am using Angular 5. Please respond.

I am also facing the same issue. I am using Angular 5. Please respond.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dc/ng2-file-upload#1093