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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:25:21+00:00 2026-05-22T20:25:21+00:00

Currently, I can retrieve the picture taken with takePicture in the function imagePickerController, but

  • 0

Currently, I can retrieve the picture taken with takePicture in the function imagePickerController, but I want to use it outside of this function, and when I try to make a global variable to use this UIImage, I don’t have any picture.
So how can I use this UIImage ?

My code :

- (void)imagePickerController:(UIImagePickerController *)aPicker didFinishPickingMediaWithInfo:(NSDictionary *)info {

    screenshot = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
}

and I use it there :

NSData *imageData=[NSData dataWithData:UIImagePNGRepresentation(screenshot)];
NSURL *url = [NSURL URLWithString:@"http://myserver/test.php"];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request addData:imageData withFileName:@"tmp.jpg" andContentType:@"image/jpeg" forKey:@"userfile"];
[request setRequestMethod:@"POST"];
[request setDelegate:self];
[request startSynchronous];
NSLog(@"responseStatusCode %i",[request responseStatusCode]);
NSLog(@"responseStatusString %@",[request responseString]);

screenshot is my global variable and I receive a blank image on my server.
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-05-22T20:25:22+00:00Added an answer on May 22, 2026 at 8:25 pm

    I’m assuming you are implementing UIImagePickerControllerDelegate? If so, when imagePickerController:didFinishPickingMediaWithInfo: is called, you can get the image out of the dictionary passed in using:

    UIImage *image = [info valueForKey:UIImagePickerControllerOriginalImage];
    

    If you want to retain the image, declare a property with retain for your viewcontroller class, and set it:

    self.image = [info valueForKey:UIImagePickerControllerOriginalImage];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can currently use sgml-pretty-print to pretty print an xml file in emacs, but
Currently i'm using these codes to save my images into NSDocumentDirectory. I use this
I want to retrieve an entire user object via a get request. Currently, on
I can't seem to properly retrieve a user's profile picture using the current iOS
How can I programmatically retrieve the current connection type (eg. LAN or Direct connection)?
Currently I can set ringtones and notifications with: byte[] buffer = null; InputStream fIn
I can currently convert a virtual directory to an application via the iis7.0 managers
I am making a logical gates application and I can currently drag out bitmaps
I have a Tomcat instance running within our corp network. Currently users can access
I have setup hadoop on top of mongodb using hadoop-mongodb driver. Currently I can

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.