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 8100507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:45:07+00:00 2026-06-05T22:45:07+00:00

I am coding an application that needs to send audio files, in mp3 or

  • 0

I am coding an application that needs to send audio files, in mp3 or any other common audio format, to a server. I am using a NSURLConnection instance to make this connection. I’m using the post method because the file that receives the information is a .php. In the same connection I need to send other parameters that are mostly strings and ints. The problem that I am facing is actually sending the audio file and receiving it in the server. I’m using the next code to build my connection:

NSMutableURLRequest *localRequest = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"whateverphpfile"]];
[localRequest setHTTPMethod:@"POST"];
[self setRequest:localRequest];
[localRequest release];

NSMutableData *body = [[NSMutableData alloc] init];

NSString *testerSTR = [NSString stringWithFormat:@"file=%@", [[NSBundle mainBundle] pathForResource:@"header" ofType:@"png"]];
[body setData:[testerSTR dataUsingEncoding:NSUTF8StringEncoding]];

//_request is of type NSMutableURLRequest
[_request setHTTPBody:body];
//[_request setValue:@"multipart/form-data" forHTTPHeaderField:@"enctype"];
[_request setValue:@"multipart/form-data" forHTTPHeaderField:@"content-type"];

NSLog(@"the body sent is: %@", [[NSString alloc] initWithData:body encoding:NSUTF8StringEncoding]);

_connection = [[NSURLConnection alloc] initWithRequest:_request delegate:self];

if (_connection)
{
    [self setWebData:[NSMutableData data]];
}
else
{
    NSLog(@"theConnection is NULL");
}

and the problem when checking the data and returning it to the device is that it is a laaarge string like <564024S D451475 DS5752... ...552D4S5>. What should I do to receive the actual audio file or how can I transform that large string into an audio file readable by the native iOS classes?

  • 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-06-05T22:45:09+00:00Added an answer on June 5, 2026 at 10:45 pm

    You need to send your data in multipart/form-data format. The second answer for this topic has code that should do just that: NSURLConnection to upload file asynchonrously?

    You could also use the ASIHTTPRequest library which can do just that.

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

Sidebar

Related Questions

I'm coding an application that needs to select an area of the screen. I
I'm coding an application where the client app needs to authenticate with a server
I have a java application that needs to connect to a server. Its rather
We're developing a cross-platform network application that needs to send and receive data over
assume that i start coding an application from scratch, is the best way to
I've been coding a little application in jQuery / JavaScript that works fine in
I’m coding an application with server resources in mind, so I don’t want to
I'm essentially writing a little script that needs to save several different files as
I'm coding a email application that produces messages for sending via SMTP. That means
I'm writing a WPF desktop application and have a view that needs to look

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.