Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to upload audio file from documnets directory to server in iphone
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/9867340/how-to-upload-a-audio-file-from-iphone-documents-folder-to-server">how to upload a audio file from iphone documents folder to server</a> </p> </blockquote> <p>I have path where is sound file in app which i record i want to send it to server how may send this i have send image upload to server but how may i send from documets folder to server</p> <p>This is the path where my files is </p> <pre><code> NSString * path = [NSString stringWithFormat:@"%@/Documents/%@_%@_%@_%@.wav", NSHomeDirectory(), theCellData.firstName,theCellData.lasttName, type]; </code></pre> <p>So may use this to upload that file to server I am uploading image from resources in this way </p> <pre><code> UIImage*myImage=[UIImage imageNamed:@"dr.jpg"]; imageView.image=myImage; NSData *imageData = UIImageJPEGRepresentation(imageView.image, 1.0); // setting up the URL to post to NSString *urlString = @"http://www.celeritas-solutions.com/emrapp/emr.php"; // setting up the request object now NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; [request setURL:[NSURL URLWithString:urlString]]; [request setHTTPMethod:@"POST"]; NSString *boundary = [NSString stringWithString:@"---------------------------14737809831466499882746641449"]; NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@",boundary]; [request addValue:contentType forHTTPHeaderField: @"Content-Type"]; NSMutableData *body = [NSMutableData data]; [body appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[[NSString stringWithString:@"Content-Disposition: form-data; name=\"userfile\"; filename=\"dr.jpg\"\r\n"] dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[[NSString stringWithString:@"Content-Type: application/octet-stream\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[NSData dataWithData:imageData]]; [body appendData:[[NSString stringWithFormat:@"\r\n--%@--\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]]; [request setHTTPBody:body]; // now lets make the connection to the web NSData *returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil]; NSString *returnString = [[NSString alloc] initWithData:returnData encoding:NSUTF8StringEncoding]; NSLog(returnString); </code></pre>
    singulars
    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.
 

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