Please help me or suggest me
---------------#################---------------
What is a possible way to upload an image in a form using formcontrolName if possible please give some suggestion
------------###########################---------------------
I am trying to upload an image file with other information like firstname, lastname and file and this is working perfect:
/* File Upload request to Upload file */
this.currentFileUpload = this.selectedFiles.item(0);
let formdata: FormData = new FormData();
formdata.append('firstName', "Harkesh");
formdata.append('lastName', "kumar");
formdata.append('file', this.currentFileUpload);
But my problem is I am sending FORM file with some string and Object, but FormData doesn't accept Object:
let formdata: FormData = new FormData();
formdata.append('functionId', this.functionId);
formdata.append('processId', this.processId);
formdata.append('file', this.currentFileUpload);
formdata.append('formDetails', userobjArr);
2nd option I am trying:
let formdata: FormData = new FormData();
formdata.append('file', this.currentFileUpload);
userDetails.name = "";
userobjWrapper["functionId"] = this.functionId;
userobjWrapper["processId"] = this.processId;
userobjWrapper["taskId"] = this.taskId;
userobjWrapper["file"] = this.currentFileUpload;
userobjWrapper["formDetails"] = userobjArr;
userobjArr is Object array that I assign with formDetails this is getting null value.
I am not sure how to do read image in one rest Service API calls? and for rest API I am using spring boot Rest Controller
can you suggest me any idea..