Asiformdatarequest is an important part of the asihttprequest class library. You need to take photos of your iPhone and then upload the photos to the server. The following figure shows how to use asiformdatarequest to upload images in post mode on the IOS client:
Nsstring * filename = [[nsbundle mainbundle] pathforresource: @ "test" oftype: @ "jpg"]; nsstring * url = @ "http ://...... /upload. aspx "; asiformdatarequest * request = [asiformdatarequest requestwithurl: [nsurl urlwithstring: url]; [Request setpostvalue: @" myname "forkey: @" name "]; [Request setfile: filename forkey: @ "this_is_file"]; [Request buildrequestheaders]; nslog (@ "header: % @", request. requestheaders); [Request startsynchronous]; nslog (@ "responsestring = % @", request. responsestring );
In the next article, I will use. Net to enable the server to receive images and save them to a specific path on the server.