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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:15:03+00:00 2026-06-04T21:15:03+00:00

I have made an iphone app to upload an audio file. I have also

  • 0

I have made an iphone app to upload an audio file.

I have also made webervices in asp.net to support other functionality for this app and published it on godaddy server.

I want to upload/save an audio file on that server from my iphone app.

I have searched many codes but they are not relevant and usefull.

So how can i do this ?

How to get serverpath where we can upload the file?

Please provide some sample code for iphone to do this.

  • 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-04T21:15:05+00:00Added an answer on June 4, 2026 at 9:15 pm

    This is how I POST a file (can be any file , image, video, audio anything) to a web-service

    NSString *fileName = @"myAudio";
        NSData *audioFile = [NSData dataWithContentsOfFile:@"myAudio.ext"]; //some audio
        NSString *urlString = @"http://www.something.com/someservice";
        urlString = [urlString stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
        NSURL *url = [NSURL URLWithString:urlString];
        NSString *strPostLength = [NSString stringWithFormat:@"%d", [audioFile length]];  
        NSMutableURLRequest *uRequest = [[NSMutableURLRequest alloc] init];  
        [uRequest setURL:url];  
        [uRequest setHTTPMethod:@"POST"];  
        if (audioFile)
        {
            NSMutableData *body = [NSMutableData data];
    
            NSString *boundary = [NSString stringWithString:@"---------------------------14737809831466499882746641449"];
            NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@",boundary];
            [uRequest addValue:contentType forHTTPHeaderField: @"Content-Type"];
    
            /*
             now lets create the body of the post
             */
    
            [body appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]];
            [uRequest setValue:strPostLength forHTTPHeaderField:@"Content-Length"];  
            [body appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"userfile\"; filename=\"%@.ext\"\r\n",fileName] dataUsingEncoding:NSUTF8StringEncoding]];
    

    //userfile -> variable name given in the server code…

            [body appendData:[[NSString stringWithString:@"Content-Type: application/octet-stream\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];
            [body appendData:[NSData dataWithData:audioFile]];
            [body appendData:[[NSString stringWithFormat:@"\r\n--%@--\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]];
    
            // setting the body of the post to the reqeust
            [uRequest setHTTPBody:body];
        }
    
        NSURLConnection *uConn=[[NSURLConnection alloc] initWithRequest:uRequest delegate:self];  
        if (uConn)   
        {  
            NSLog(@"Failed to connect to url"); 
        } 
        uRequest = nil;
    

    I hope this will help you in solving your issue…

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

Sidebar

Related Questions

I have made an iPhone App which has a loginwithFacebook button , the login
I have made an app that implements the iPhone's camera. When the user finishes
I have made an app which uses DropBox SDK for iPhone to connect to
I have made an iPhone app with localized versions. It mostly works fine, but
I'm looking to upload an mp3 file from my iPhone app to a given
I have made the mistake when starting the coding an iPhone App of not
I am making an iPhone app in which I have made a custom activity
So I made my iPhone app universal, it created a new mainWindow xib file
In an IPhone app I made a constants file to hold my global variables:
I have made an iPhone app building with SDK 3, expecting it to run

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.