go to post Federico Sandrinelli · Feb 25 The logs were the ones I wrote in my previous response, however I found the solution to be this one: set boundary = $PIECE(pRequest.HTTPHeaders.GetAt("content-type"),"boundary=",2) Set reader = ##class(%Net.MIMEReader).%New() Set sc = reader.OpenStream(pRequest.Stream) If $$$ISERR(sc) { $$$LOGERROR("Failed to open stream: "_$System.Status.GetErrorText(sc)) Quit } set a=0 while a'=1 { Set sc=reader.readHeader(.message,1) $$$LOGINFO(message.GetHeader("Content-Type")) $$$LOGINFO($p(message.GetHeader("Content-Disposition"),"""",2)) Set sc=reader.readBody(message,boundary,.a) Set body = message.Body.Read() $$$LOGINFO(body) } The key was to correctly retrieve the boundry in the first place. Thank you again for your solution which turned out to be correct!
go to post Federico Sandrinelli · Feb 25 Hi, thank you for your answer! Your solution somehow acess the content of the message but not how one would expect. By using as a reference the request I posted in my question the output of your code are three logs: 1st: text/plain 2nd: first field 3rd: " test----------------------------968066144412655705281003 Content-Disposition: form-data; name="third field" Content-Type: text/plain test 2 ----------------------------968066144412655705281003--" It seems like the code is reading everything after the header of the first field of the multipart message as the body, not using the boundary properly. In fact, the first line of yout code retrieves only an empty string. I have tried to modify your code to actually access the boundary by doing Set bii = message.BoundaryGet() in the second line of the while. But then I got an <INVALID OREF> when trying to read the body.