How to pass 3 argument to backend with `POST` request?Angular (5) httpclient observe and responseType: 'blob'How to send post request with only 1 argument in Angular?Angular 6: Updating POST request from Http to HttpClientHow can I get both body and headers from http request in angular 7Angular 7 HttpClient post response headers are emptyAngular 7 HttpClient post 404Angular 7: Post request always send a null bodyNot able to fetch data from backend got 404Post data to API with or without subscribeAngular - Cancel prior HTTP request if a later request fails

UK - Working without a contract. I resign and guy wants to sue me

Is it possible to get a mortgage with a custom duration in the US?

What is the highest voltage from the power supply a Raspberry Pi 3 B can handle without getting damaged?

Why does the Saturn V have standalone inter-stage rings?

Is there any proof that high saturation and contrast makes a picture more appealing in social media?

How does DC work with natural 20?

How do I professionally let my manager know I'll quit over an issue?

When to remove insignificant variables?

Helping ease my back pain by studying 13 hours everyday , even weekends

Why is it easier to balance a non-moving bike standing up than sitting down?

Greeting with "Ho"

Do I need a shock-proof watch for cycling?

What's currently blocking the construction of the wall between Mexico and the US?

Should an enameled cast iron pan be seasoned?

Cut the gold chain

Confusion over 220 and 230 volt outlets

Why do all the teams that I have worked with always finish a sprint without completion of all the stories?

RandomInteger with equal number of 1 and -1

Heavily limited premature compiler translates text into excecutable python code

How does a blind passenger not die, if driver becomes unconscious

What are Elsa's reasons for selecting the Holy Grail on behalf of Donovan?

How did Gollum enter Moria?

Designing a magic-compatible polearm

Why isn't my calculation that we should be able to see the sun well beyond the observable universe valid?



How to pass 3 argument to backend with `POST` request?


Angular (5) httpclient observe and responseType: 'blob'How to send post request with only 1 argument in Angular?Angular 6: Updating POST request from Http to HttpClientHow can I get both body and headers from http request in angular 7Angular 7 HttpClient post response headers are emptyAngular 7 HttpClient post 404Angular 7: Post request always send a null bodyNot able to fetch data from backend got 404Post data to API with or without subscribeAngular - Cancel prior HTTP request if a later request fails






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















According to backend, I require to pass 3 argument through post request, this backend function is:



public ResponseModel Post([FromBody] CourseFileUpload item, string fileName, Stream fileToUpload) 


now I am trying to pass the argument like this:



uploadFile(uploadData:ModelToFileSteam):Observable<ModelToFileSteam> 
const fileName = uploadData.fileName;
console.log('file name is', fileName);
const headers = new HttpHeaders( 'Content-Type': 'application/json', 'Access-Control-Allow-Origin':'*' );
return this.http.post<ModelToFileSteam>(environment.baseUrl+`CourseFileUpload`, uploadData.fileToUpload, uploadData.fileName, uploadData.uploadStream)
.pipe(
map(data =>
return data;
),
catchError(this.handleError)
)



But getting error, not able to pass 3 arguments at all. what is the correct way to do this?



any one help me?










share|improve this question




























    0















    According to backend, I require to pass 3 argument through post request, this backend function is:



    public ResponseModel Post([FromBody] CourseFileUpload item, string fileName, Stream fileToUpload) 


    now I am trying to pass the argument like this:



    uploadFile(uploadData:ModelToFileSteam):Observable<ModelToFileSteam> 
    const fileName = uploadData.fileName;
    console.log('file name is', fileName);
    const headers = new HttpHeaders( 'Content-Type': 'application/json', 'Access-Control-Allow-Origin':'*' );
    return this.http.post<ModelToFileSteam>(environment.baseUrl+`CourseFileUpload`, uploadData.fileToUpload, uploadData.fileName, uploadData.uploadStream)
    .pipe(
    map(data =>
    return data;
    ),
    catchError(this.handleError)
    )



    But getting error, not able to pass 3 arguments at all. what is the correct way to do this?



    any one help me?










    share|improve this question
























      0












      0








      0








      According to backend, I require to pass 3 argument through post request, this backend function is:



      public ResponseModel Post([FromBody] CourseFileUpload item, string fileName, Stream fileToUpload) 


      now I am trying to pass the argument like this:



      uploadFile(uploadData:ModelToFileSteam):Observable<ModelToFileSteam> 
      const fileName = uploadData.fileName;
      console.log('file name is', fileName);
      const headers = new HttpHeaders( 'Content-Type': 'application/json', 'Access-Control-Allow-Origin':'*' );
      return this.http.post<ModelToFileSteam>(environment.baseUrl+`CourseFileUpload`, uploadData.fileToUpload, uploadData.fileName, uploadData.uploadStream)
      .pipe(
      map(data =>
      return data;
      ),
      catchError(this.handleError)
      )



      But getting error, not able to pass 3 arguments at all. what is the correct way to do this?



      any one help me?










      share|improve this question














      According to backend, I require to pass 3 argument through post request, this backend function is:



      public ResponseModel Post([FromBody] CourseFileUpload item, string fileName, Stream fileToUpload) 


      now I am trying to pass the argument like this:



      uploadFile(uploadData:ModelToFileSteam):Observable<ModelToFileSteam> 
      const fileName = uploadData.fileName;
      console.log('file name is', fileName);
      const headers = new HttpHeaders( 'Content-Type': 'application/json', 'Access-Control-Allow-Origin':'*' );
      return this.http.post<ModelToFileSteam>(environment.baseUrl+`CourseFileUpload`, uploadData.fileToUpload, uploadData.fileName, uploadData.uploadStream)
      .pipe(
      map(data =>
      return data;
      ),
      catchError(this.handleError)
      )



      But getting error, not able to pass 3 arguments at all. what is the correct way to do this?



      any one help me?







      angular7 angular-httpclient






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 25 at 7:25









      3gwebtrain3gwebtrain

      5,7981769150




      5,7981769150






















          2 Answers
          2






          active

          oldest

          votes


















          3














          I will suggest wrapping all in a single object. And send it to backend.



          Or just send uploadData



          return this.http.post<ModelToFileSteam>(environment.baseUrl+`CourseFileUpload`, uploadData)
          .pipe(
          map(data =>
          return data;
          ),
          catchError(this.handleError)
          )


          And in the backend, you can get uploadDate like req.body.uploadData
          To check you can console.log(uploadData.fileName);






          share|improve this answer






























            1














            its my working example



            this.http.post<Customer>(this.base_url + 'v1/customers', client, this.getHeaders());


            Where client is customer object and this.getHeaders() is:



             getHeaders() 
            return
            headers: new HttpHeaders(
            'Content-Type': 'application/json; charset=utf-8',
            )
            ;



            Good luck!






            share|improve this answer























              Your Answer






              StackExchange.ifUsing("editor", function ()
              StackExchange.using("externalEditor", function ()
              StackExchange.using("snippets", function ()
              StackExchange.snippets.init();
              );
              );
              , "code-snippets");

              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "1"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55332958%2fhow-to-pass-3-argument-to-backend-with-post-request%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              3














              I will suggest wrapping all in a single object. And send it to backend.



              Or just send uploadData



              return this.http.post<ModelToFileSteam>(environment.baseUrl+`CourseFileUpload`, uploadData)
              .pipe(
              map(data =>
              return data;
              ),
              catchError(this.handleError)
              )


              And in the backend, you can get uploadDate like req.body.uploadData
              To check you can console.log(uploadData.fileName);






              share|improve this answer



























                3














                I will suggest wrapping all in a single object. And send it to backend.



                Or just send uploadData



                return this.http.post<ModelToFileSteam>(environment.baseUrl+`CourseFileUpload`, uploadData)
                .pipe(
                map(data =>
                return data;
                ),
                catchError(this.handleError)
                )


                And in the backend, you can get uploadDate like req.body.uploadData
                To check you can console.log(uploadData.fileName);






                share|improve this answer

























                  3












                  3








                  3







                  I will suggest wrapping all in a single object. And send it to backend.



                  Or just send uploadData



                  return this.http.post<ModelToFileSteam>(environment.baseUrl+`CourseFileUpload`, uploadData)
                  .pipe(
                  map(data =>
                  return data;
                  ),
                  catchError(this.handleError)
                  )


                  And in the backend, you can get uploadDate like req.body.uploadData
                  To check you can console.log(uploadData.fileName);






                  share|improve this answer













                  I will suggest wrapping all in a single object. And send it to backend.



                  Or just send uploadData



                  return this.http.post<ModelToFileSteam>(environment.baseUrl+`CourseFileUpload`, uploadData)
                  .pipe(
                  map(data =>
                  return data;
                  ),
                  catchError(this.handleError)
                  )


                  And in the backend, you can get uploadDate like req.body.uploadData
                  To check you can console.log(uploadData.fileName);







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 26 at 5:12









                  AshishAshish

                  541111




                  541111























                      1














                      its my working example



                      this.http.post<Customer>(this.base_url + 'v1/customers', client, this.getHeaders());


                      Where client is customer object and this.getHeaders() is:



                       getHeaders() 
                      return
                      headers: new HttpHeaders(
                      'Content-Type': 'application/json; charset=utf-8',
                      )
                      ;



                      Good luck!






                      share|improve this answer



























                        1














                        its my working example



                        this.http.post<Customer>(this.base_url + 'v1/customers', client, this.getHeaders());


                        Where client is customer object and this.getHeaders() is:



                         getHeaders() 
                        return
                        headers: new HttpHeaders(
                        'Content-Type': 'application/json; charset=utf-8',
                        )
                        ;



                        Good luck!






                        share|improve this answer

























                          1












                          1








                          1







                          its my working example



                          this.http.post<Customer>(this.base_url + 'v1/customers', client, this.getHeaders());


                          Where client is customer object and this.getHeaders() is:



                           getHeaders() 
                          return
                          headers: new HttpHeaders(
                          'Content-Type': 'application/json; charset=utf-8',
                          )
                          ;



                          Good luck!






                          share|improve this answer













                          its my working example



                          this.http.post<Customer>(this.base_url + 'v1/customers', client, this.getHeaders());


                          Where client is customer object and this.getHeaders() is:



                           getHeaders() 
                          return
                          headers: new HttpHeaders(
                          'Content-Type': 'application/json; charset=utf-8',
                          )
                          ;



                          Good luck!







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Mar 25 at 8:08









                          user3804427user3804427

                          1396




                          1396



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55332958%2fhow-to-pass-3-argument-to-backend-with-post-request%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                              SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                              은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현