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

  • Home
  • SEARCH
  • 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 9158633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:17:39+00:00 2026-06-17T13:17:39+00:00

I am posting multiple images to server url,But i am facing one issue. After

  • 0

I am posting multiple images to server url,But i am facing one issue.
After posting the image datas,The serever get only the image data i send first.The remaining datas are null.But at the time of posting i can print the datas (NSLog)

Please help me to understand the problem
Giving my code here

UploadImageViewController.m

-(IBAction)upPic:(id)sender{
UploadImage *up_image = [[UploadFood alloc] init];

  [up_image sendServerRequests:[NSDictionary  dictionaryWithObjectsAndKeys:@"pic1.jpg",@"filename",@"pic2.jpg",@"filename2", nil]  file:sharedClass.picData file1:sharedClass.picData2];


   }  

UploadImage.m

-(void)sendServerRequests:(NSDictionary *)bits file:(NSData *)file file1:(NSData *)file1 file2:(NSData *)file2 {
 NSLog(@"file  %@",file );


 [postbody appendData:[NSData dataWithData:file]];

 [postbody appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data;  name=\"image2\"; filename=\"%@\"\r\n", [bits objectForKey:@"filename2"]]  dataUsingEncoding:NSUTF8StringEncoding]];
 [postbody appendData:[@"Content-Type: application/octet-stream\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]];

  NSLog(@"file1 %@",file1);


  [postbody appendData:[NSData dataWithData:file1]];

  [postbody appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"image3\"; filename=\"%@\"\r\n", [bits objectForKey:@"filename3"]] dataUsingEncoding:NSUTF8StringEncoding]];
  [postbody appendData:[@"Content-Type: application/octet-stream\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]];

  NSLog(@"file2 %@",file2);  // i am able to print data here

  [postbody appendData:[NSData dataWithData:file2]];



  [postbody appendData:[[NSString stringWithFormat:@"\r\n--%@--\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]];


   [request setHTTPBody:postbody];


  conn = [[NSURLConnection alloc] initWithRequest:request delegate:self];
    if (conn) {
    webData = [NSMutableData data];
   }


  }
  • 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-17T13:17:40+00:00Added an answer on June 17, 2026 at 1:17 pm

    Hey Nithin MK AS per your code you did all things perfectly ok.

    in the current situation, only the first file is uploading on the server. I think if you are not uploading the first file and uploading the second file it would be uploaded.

    So I suggest that you can use the array for this. if your web service using php/.net then you can use the array for the file name.

    so try with use

    name=\”image2[]\”;

    name=\”image3[]\”;

    and also please check your web service with this.

    Thanks.

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

Sidebar

Related Questions

I have an issue with multiple images upload to php server. The code given
I am appending multiple input boxes and successfully posting one input array to the
While posting form with miltiple images i get different redirect than while posting on
I am posting multiple files to my controller but it does not seem to
Posting this one for a friend. They have an Icefaces app that uses Icefaces's
I have seen many posting this issue in SO. I have gone through those
I have a multiple select variable posting to controller. The way multiple select works
I'm posting my first question here after having viewed many useful exchanges by others;
Solved while writing this question, but posting in case it helps anyone: I'm setting
Ok this is a bizarre issue... rather than posting lots of code I will

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.