Receive file rest api

Home Forums kbmMW Receive file rest api

Tagged: , , ,

Viewing 1 reply thread
  • Author
    Posts
    • #57597
      andersonvieirafiori
      Participant

      Hello.
      I’m creating a rest api, I can now send and receive requests, but I’m having difficulty receiving and sending files, I’m trying the following way but it doesn’t work, I’m getting an Invalid header size error.
      I’m trying to send a file via Postman with binary body.
      [kbmMW_Rest(‘method:post, path:saveFile’)]
      function saveFile([kbmMW_Rest(‘value:body’)] aFile: TStream):string;
      This would be the way I am trying to receive the file.
      What would the correct way be?
      tkx a lot.

    • #57598
      andersonvieirafiori
      Participant

      I managed to solve it, following the instructions Kim gave me and following the blog

      REST easy with kbmMW #15 – Handling HTTP POST


      I was able to receive files via multipart form-data and via stream.

      ForceDirectories(‘.\receivedfiles’);
      sFileName:=’.\receivedfiles\file.png’;

      RequestStream.SaveToFile(sFileName);

      thank you very much

Viewing 1 reply thread
  • You must be logged in to reply to this topic.