I'm trying to upload files in my angular2 application. Currently I'm using the ng2-file-upload directives and it works for uploading files. However, I would like to also upload a JSON object.Please help me
-
What do you mean by upload a JSON object ? Send it by an http request ?Radouane ROUFID– Radouane ROUFID2017-07-20 06:02:05 +00:00Commented Jul 20, 2017 at 6:02
-
shopcontact(request) {debugger; var front_print=this.requestv; var back_print=this.requestv; let front_printvalue: File = this.requestv[0]; let back_printvalue: File = this.requestv[0]; var formData = new FormData(); formData.append("front_print",front_printvalue,front_printvalue.name); formData.append('back_print',back_printvalue,back_printvalue.name); return this._http.post(this._url + 'shop', request, { headers: headers,vasudevarao– vasudevarao2017-07-20 06:19:02 +00:00Commented Jul 20, 2017 at 6:19
-
i want to file upload along with json datavasudevarao– vasudevarao2017-07-20 06:19:30 +00:00Commented Jul 20, 2017 at 6:19
-
var tshirtbody = "event_name=" + request.eventname + "&name=" + "vasu"+ "&front_print=" + fdg+ "vasu" + "&item_quality=" + 2 + "&email=" + request.email + "&mobile=" + request.mobile + "&no_of_items=" + request.nooftshirts + "&item_type=" + request.tshirttype + "&text_print=" + request.text_print; var formData = new FormData(); formData.append("front_print",front_printvalue,front_printvalue.name); formData.append('back_print',back_printvalue,back_printvalue.name); return this._http.post(this._url + 'shop', body,formData )vasudevarao– vasudevarao2017-07-20 06:27:59 +00:00Commented Jul 20, 2017 at 6:27
-
I finally found a proper way to upload a file and send some JSON within the same request and made a proper answer here: stackoverflow.com/questions/39693966/…maxime1992– maxime19922017-11-21 08:19:21 +00:00Commented Nov 21, 2017 at 8:19
Add a comment
|