更新时间:2023-01-07 15:32:21
我正在使用ASIHTTPRequest上传如下所示的音频文件
I am using ASIHTTPRequest to upload an audio file like below,
NSURL *audiourl = [NSURL URLWithString:@"Your Url"];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:audiourl];
NSData *postData = [NSData dataWithContentsOfURL:SoundPath];
//SoundPath is your audio url path of NSDocumentDirectory.
[request addData:postData withFileName:@"myAudio.caf" andContentType:@"audio/caf" forKey:@"company_audio"];
[request setDelegate:self];
[request startSynchronous];
通过这种方式,您可以轻松地将音频文件上传到服务器上.
This way you can easily upload audio file on server.