Decode received multipart/form-data request in Cocoa
Posted
by Snej
on Stack Overflow
See other posts from Stack Overflow
or by Snej
Published on 2010-04-04T12:57:57Z
Indexed on
2010/04/04
13:03 UTC
Read the original article
Hit count: 595
Hi: I wonder if there is any possibility to explicitly decode an incoming multipart/form-data POST request. Is there any lib to handle this safely? Several files are embedded in this request and I want to save these files individually.
NSData *data = [(id)CFHTTPMessageCopyBody(request) autorelease];
Content-Type: multipart/form-data; boundary=0xKhTmLbOuNdArY
The data content is:
--0xKhTmLbOuNdArY
Content-Disposition: form-data; name="file1"; filename="fileName1.extension"
Content-Type: application/octet-stream; charset=utf-8
.........
--0xKhTmLbOuNdArY
Content-Disposition: form-data; name="file2"; filename="fileName2.extension"
Content-Type: application/octet-stream; charset=utf-8
.........
--0xKhTmLbOuNdArY--
© Stack Overflow or respective owner