Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>Hi, </code></pre> <p>By using this code you can send any audio file to server...follow this simple steps.. This steps are also applicable when you want to send image to server</p> <pre><code>NSString *postData = [NSString stringWithFormat:@"Your XML goes here"; </code></pre> <p>titleForSegmentAtIndex:self.participantSegmentCtrl.selectedSegmentIndex],ratingStar,[NSString stringWithFormat:@"%d", adviceTypeSegmentCtrl.selectedSegmentIndex],USER_CREDENTIALS]; NSLog(@"local audio upload ... %@",postData); NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];</p> <p>NSString *urlString = [SERVER_IP stringByAppendingString:@"getAudioadvise_ipad.php"]; NSData *audioData = [[NSData alloc]initWithContentsOfFile:fileName]; //if ([audioData length]&lt;=0) // return;</p> <p>request= [[[NSMutableURLRequest alloc] init] autorelease]; [request setURL:[NSURL URLWithString:urlString]]; [request setHTTPMethod:@"POST"];</p> <p>NSString *boundary = @"---------------------------14737809831466499882746641449";</p> <p>NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@",boundary];</p> <p>[request addValue:contentType forHTTPHeaderField: @"Content-Type"];</p> <p>NSMutableData *postbody = [NSMutableData data];</p> <p>//parameter1 [postbody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]]; [postbody appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"postData\"\r\n\r\n%@", postData] dataUsingEncoding:NSUTF8StringEncoding]]; [postbody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]]; //Tags</p> <p>[postbody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]]; [postbody appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"userfile\"; filename=\"%@.wav\"\r\n", [schedule_Obj.ID objectAtIndex:[schedule_Obj.recordIndex intValue]]] dataUsingEncoding:NSUTF8StringEncoding]]; [postbody appendData:[[NSString stringWithString:@"Content-Type: application/octet-stream\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]]; [postbody appendData:[NSData dataWithData:audioData]];//add audio data here [postbody appendData:[[NSString stringWithFormat:@"\r\n--%@--\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]];</p> <p>[request setHTTPBody:postbody]; NSData *returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil]; returnString = [[NSString alloc] initWithData:returnData encoding:NSUTF8StringEncoding]; [audioData release]; </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload