0

I need to send a PDF file with a value (basically a String) to an .ASP endpoint.

I know how to fetch a file with UIDocumentPickerViewController and how to transform it as a Data object. I've also red this thread as a start to send a file to an endpoint, but I don't know how to send another value alongside with the file.

Thanks for your help.

Rob
  • 4,123
  • 3
  • 33
  • 53
  • The endpoint would normally have a way for you to do this and specify it. For example, with a querystring parameter, like URL?extrastring=s – Lou Franco Dec 28 '17 at 19:40
  • @LouFranco Thanks for your answer. So if I get it right, the whole request should be a `POST` one like `URL?extrastring=s&data=[bytearray]`, is it correct? – Rob Dec 28 '17 at 20:01
  • 1
    A post would have the byte array in the body. – Kevin Raffay Dec 28 '17 at 20:17
  • That information should be provided by your endpoint developer. But, usually you would not send a PDF that way -- you'd do it like you do a file upload. See https://stackoverflow.com/questions/8659808/how-does-http-file-upload-work – Lou Franco Dec 28 '17 at 20:19
  • Read Lou Franco's link to see how to send multipart forms. You can encode multiple things in the POST body, which use separator strings. Also, you could just send the PDF, and send the string as part of the URL, or also as an HTTP header. But you still have to ask the question, how does my .ASP endpoint expect to see this data? – Owen Hartnett Dec 28 '17 at 21:59

0 Answers0