Friday, April 29, 2011

ASIFormDataRequest, binary data, and NSURL

In the previous post, i'd mentioned bout the ASIHTTPRequest by http://allseeing-i.com.  It is beautifully done and i urge you to grab that on GitHub if your cocoa development has req/resp to/fro a http server.

As a small note, if you do tend to 'upload' binary data with ASIFormDataRequest, and your binary data is dynamically created and stored in, for example, a tmp folder, noted as an NSURL.

These lines of code might save you a few minutes.

NSURL* url = ....;
[request setFile: [url relativePath] forKey: @"somePostKey"];
[request startSynchronous]; //or async.

No comments:

Post a Comment