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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:03:07+00:00 2026-06-02T16:03:07+00:00

Here it is my code to upload an audio file . I tried lot

  • 0

Here it is my code to upload an audio file. I tried lot of questions and answers in stackoverflow. But still i am not getting any improvement on this. I have to upload an audio file with a php link. If i do that, i am getting response like “already exists” always. I tried to change the filename and upload it. still getting same response. Actually i have to receive a response from the server as link of a file i uploaded. I am not having any knowledge about php. Anyone help me with this. Any help would be appreciated to clear my issue.

   NSData *fileData=[NSData dataWithContentsOfURL:soundFileURL];
    NSMutableURLRequest *request=[NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://somesite.com/upload.php"]];
    [request setHTTPMethod:@"POST"];

    NSString *boundary = [NSString stringWithString:@"---------------------------14737809831466499882746641449"];
    NSMutableData *body = [[NSMutableData alloc]init];
    [body appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]];
    [body appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"userfile\"; filename=\"fvgv4r346r4r4h3ur543ty5u54y5u4574545g4g5.samr\"\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];
    //[soundFileURL lastPathComponent]
    [body appendData:[[NSString stringWithString:@"Content-Type: music/samr\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];
    [body appendData:fileData];
    [body appendData:[[NSString stringWithFormat:@"\r\n--%@--\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]];
    [request setHTTPBody:body];
    NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@",boundary];
    [request addValue:contentType forHTTPHeaderField: @"Content-Type"];

//    NSLog(@"%@",[NSString stringWithUTF8String:[body bytes]]);

    NSData *returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
    NSString *returnString = [[NSString alloc] initWithData:returnData encoding:NSUTF8StringEncoding];
    NSLog(@"%@",returnString);
  • 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-02T16:03:08+00:00Added an answer on June 2, 2026 at 4:03 pm

    [body appendData:[[NSString stringWithString:@"Content-Type: music/samr\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];

    I suspect this line

    Also check your input variable

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

Sidebar

Related Questions

I tried uploading an audio file from android client to server but I'm getting
Here is the code - upload file to uri. I can't upload it. Is
please check my code: Here i'm trying to upload screenshot to facebook album, but
I have this line of CSS code here... background-image:url(upload/<?php echo $array['image']; ?>); but the
hi thanks a lot i have one code below in this code ill upload
My code to upload the file on the REMOTE server doesn't seem to be
I'm new to python and I'm writing a code to upload a file using
I am using the basic upload code from the w3schools website but I would
JSP CODE: Upload File: <input name=file type=file id=file><br><br> <input type=submit name=Submit value=Submit/><br><br> <input type=reset
This is my jquery code to upload multiple file. Input file generated dynamically so

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.