Viewing 1 replies (of 1 total)
  • Thread Starter gggruse

    (@gggruse)

    Finally figured it out, here is the code to upload via iOS this is based on the ASIHTTPDataRequest framework….

    self.uploadRequest = [ASIFormDataRequest requestWithURL:myurl]; 
    
    NSString *POSTBoundary = [NSString stringWithString:@"0xKhTmLbOuNdArY"];
    [self.uploadRequest setPostValue:[NSString stringWithFormat:@"multipart/form-data; boundary=%@", POSTBoundary] forKey:@"Content-Type"];
    
    [self.uploadRequest setRequestMethod:@"POST"];
    [self.uploadRequest setPostValue:@"photosmash_api" forKey:@"action"];
    [self.uploadRequest addPostValue:@"upload" forKey:@"photosmash_action"];
    
    NSString *message = @"testMessage";
    [self.uploadRequest addPostValue:message forKey:@"bwbps_imgcaption"];
    
    NSData *imageData = UIImageJPEGRepresentation(self.currentImage, 1.0);
    [self.uploadRequest setData:imageData withFileName:@"photo.jpg" andContentType:@"image/jpeg" forKey:@"bwbps_uploadfile"];
    
    [self.uploadRequest setDelegate:self];
    [self.uploadRequest startAsynchronous];

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: PhotoSmash Galleries] Any documentation for the mobile API?’ is closed to new replies.