For my app i need to send a image to a php file. I already know how to send strings using this:
var bodyData = "info=test"
let URL: NSURL = NSURL(string: "LINK TO A PHP FILE")
let request:NSMutableURLRequest = NSMutableURLRequest(URL:URL)
request.HTTPMethod = "POST"
request.HTTPBody = bodyData.dataUsingEncoding(NSUTF8StringEncoding);
NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.mainQueue())
{
(response, data, error) in
println(NSString(data: data, encoding: NSUTF8StringEncoding))
}
And in my php file:
$info = $_POST['info'];
echo $info;
But i don't know how to send a image