Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6696715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:22:27+00:00 2026-05-26T06:22:27+00:00

i have two function recordsound and post this recorded sound to the server. this

  • 0

i have two function recordsound and post this recorded sound to the server.

this is the following code i used to post to the server

 NSString *filePath = [[NSBundle mainBundle] pathForResource:@"recordedTmpFile" ofType:@"caf"];
 NSURL *file =[[NSURL alloc] initFileURLWithPath:filePath];
 NSString *filepath = [[NSBundle mainBundle]  initWithContentsOfURL:recordedTmpFile];
 NSData *postData = [NSData dataWithContentsOfFile:filePath];

//nsdata to string

 NSString* newStr = [NSString stringWithUTF8String:[postData  bytes]];

//http post

NSMutableString *jsonRequest = [[NSMutableString alloc]init];
[jsonRequest appendString:newStr];
NSURL *url = [NSURL URLWithString:@"http address"];


NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url];
NSData *requestData = [NSData dataWithBytes:[jsonRequest UTF8String] length:[jsonRequest length]];

[request setHTTPMethod:@"POST"];
[request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setValue:[NSString stringWithFormat:@"%d", [requestData length]] forHTTPHeaderField:@"Content-Length"];
[request setHTTPBody: requestData];

[NSURLConnection connectionWithRequest:[request autorelease] delegate:self];
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:22:27+00:00Added an answer on May 26, 2026 at 6:22 am

    I am using ASIHTTPRequest‘s library. It has a setFile: method to allow you posting a file to the server.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have the following code: function One() {} One.prototype.x = undefined; function Two()
I have this function with some dead code, marked by Eclipse. I have two
I have two questions for the following example: function doIt(){ this.attribute = someValue; //
I have two constructor : function clsUsagerEmailUserName($nickName, $email) { $this->nickName = $nickName; $this->email =
I have this Two Methods private function cacheAdd($id,$data) { $this->minicache->set($id,$data); } private function cacheGet($id)
I have two actions in controller: function indexAction() { $this->_redirect('/index/welcome/'); } function welcomeAction() {
I have pasted two function from my code. They are for adding a tab
I have two code files, one contains my WinMain() function, and all functions related
I have two controllers: test.php public function trackback() { $this->load->library('trackback'); $tb_data = array( 'ping_url'
I have two classes that each need an instance of each other to function.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.