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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:14:37+00:00 2026-06-10T05:14:37+00:00

I’m developing an app that allows users to upload their photos to my web

  • 0

I’m developing an app that allows users to upload their photos to my web server. I’ve recently added support for uploading multiple files at once: users can select photos from their iPhone album and upload then to the server.

Uploading one file is no problem, however, when I try to upload multiple files, I get the following error:

The operation couldn't be completed (kCFErrorDomainCFNetwork error 303.)

The code I’m using for uploading the files is the following:

// start the uploading for each photo
for(int i = 0; i < photosArray.count; i++)
{
    Photo *currentPhoto = [photosArray objectAtIndex:i];

    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"upload", @"command", UIImageJPEGRepresentation(currentPhoto.image,70),@"file", [NSNumber numberWithInt:album.albumId], @"albumId", currentPhoto.title, @"title", currentPhoto.description, @"description", nil];

    [[AFAPI sharedInstance] commandWithParams:params onCompletion:^(NSDictionary *json)
     {
         //completion
         if (![json objectForKey:@"error"]) 
         {
             // hide the UIProgressView and show the detail label
             UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:i inSection:0]];
             UIProgressView *pv = (UIProgressView *) [cell viewWithTag:4];
             pv.hidden = YES;

             UILabel *detailLabel = (UILabel *) [cell viewWithTag:3];
             detailLabel.text = @"Upload completed";
             detailLabel.hidden = NO;

         } 
         else 
         {
             //error :(
             NSString* errorMsg = [json objectForKey:@"error"];
             [UIAlertView error:errorMsg];
         }
     }
     onUploadProgress:^(NSInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) 
    {
         // ...
    }];
}

I’m enumerating the photosArray with a for loop and for every photo it finds, it uploads the image (currentPhoto.image). The implementation of the commandWithParams function is:

-(void)commandWithParams:(NSMutableDictionary*)params onCompletion:(JSONResponseBlock)completionBlock onUploadProgress:(void (^)(NSInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))uploadProgressBlock
{
    NSData* uploadFile = nil;
    if ([params objectForKey:@"file"]) 
    {
        uploadFile = (NSData*)[params objectForKey:@"file"];
        [params removeObjectForKey:@"file"];
    }

NSMutableURLRequest *apiRequest = 
[self multipartFormRequestWithMethod:@"POST" 
                                path:kAPIPath 
                          parameters:params 
           constructingBodyWithBlock: ^(id <AFMultipartFormData>formData) {
               if (uploadFile) {
                   [formData appendPartWithFileData:uploadFile 
                                               name:@"file" 
                                           fileName:@"photo.jpg" 
                                           mimeType:@"image/jpeg"];
               }
           }];

AFJSONRequestOperation* operation = [[AFJSONRequestOperation alloc] initWithRequest: apiRequest];
[operation setUploadProgressBlock:uploadProgressBlock];

[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
    //success!
    completionBlock(responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
    //failure :(
    completionBlock([NSDictionary dictionaryWithObject:[error localizedDescription] forKey:@"error"]);
}];

[operation start];
}

Sorry for the long code part but I really can’t figure out how to solve this error. I’ve tried to use a NSOperationQueue but that also gave the same error.

I’ve searched on internet, and I figured out that error 303 in the CFNetwork means that the HTTP response couldn’t be parsed. Could it be that the problem is in the web service? If so, I can also give the php part where I handle the uploaded file 🙂

Thanks in advance!

  • 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-10T05:14:38+00:00Added an answer on June 10, 2026 at 5:14 am

    I think that this was a bug in AFNetworking. I had the exact same issue, but upgrading to the latest version downloaded on August 24, 2012 resolved the problem for me.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I am writing an app with both english and french support. The app requests
I am using Paperclip to handle profile photo uploads in my app. They upload
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a

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.