在我的应用程序中,我需要记录声音。在此之后,我需要在PHP服务器异步发送声音文件
考虑使用ASIHTTPRequest http://allseeing-i.com/ASIHTTPRequest/。这是一个方便的框架来建立http连接。
这个例子很适合你的问题:
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
// Upload a file on disk
[request setFile:@"/Users/ben/Desktop/ben.jpg" withFileName:@"myphoto.jpg" andContentType:@"image/jpeg"
forKey:@"photo"];
// Upload an NSData instance
[request setData:imageData withFileName:@"myphoto.jpg" andContentType:@"image/jpeg" forKey:@"photo"];