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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T00:55:41+00:00 2026-06-17T00:55:41+00:00

I am having some troubles saving images path into Documents folder and store the

  • 0

I am having some troubles saving images path into Documents folder and store the path into my sqlite3 local db.

Today I successfully stored the images as BLOB into the db, but reading around the Internet, people said that this is not recommended.

So, now I’m trying to store image path in DB but..

Situation

  1. User taps a button to choose an image (via UIImagePickerView) or take a new photo
  2. After choosing the image, an imageView is set with the image chosen.

Code for picker:

-(void)imagePickerController:(UIImagePickerController *)pickr didFinishPickingMediaWithInfo:(NSDictionary *)info{
    UIImage *image = [info objectForKey:UIImagePickerControllerEditedImage];
    /* Test code for saving data */   
    //NSString *dir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
    //NSString *pngPath = [NSString stringWithFormat:@"%@/test.png",dir];
    //NSData *data = [NSData dataWithData:UIImagePNGRepresentation(image)];
    //[data writeToFile:pngPath atomically:YES];

    [imageView setImage:image];
    picture = YES;
    [pickr dismissModalViewControllerAnimated:YES];
}

Now I got a couple of questions

  1. Into my db, image is BLOB type. Should I edit it to TEXT?
  2. How is the path saved? I mean, in the test code /test.png is a generic image name. Does the chosen image name get saved too so that I can retrieve it? Or, better, if I save an image picked from my library with name “IMG0001”, does it get saved as “test”?
  3. What’s the right way to save an image into documents folder, its path to the DB and then retrieve it?

I googled a lot to find an answer, but after experimenting a lot I gave up.

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-17T00:55:43+00:00Added an answer on June 17, 2026 at 12:55 am

    Here is nice tutorial on how to save images in Documents directory

    You need to convert your BLOB field to TEXT field and just save file name of that image. You can also create folder in Documents directory and then access by foldername/filename.png.

    Hope this information helps you..

    EDIT

    Here is code to check if that folder exits, If not exist create new that folder

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentsDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0]; // Get documents folder
    NSString *dataPath = [documentsDirectory stringByAppendingPathComponent:@"MyFolder"];
    
    if (![[NSFileManager defaultManager] fileExistsAtPath:dataPath]){
    
        NSError* error;
        if(  [[NSFileManager defaultManager] createDirectoryAtPath:dataPath withIntermediateDirectories:NO attributes:nil error:&error])
            ;// success
            else
            {
                NSLog(@"[%@] ERROR: attempting to write create MyFolder directory", [self class]);
                NSAssert( FALSE, @"Failed to create directory maybe out of disk space?");
            }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've successfully implemented passport-local into my Express/Mongoose web-app but I'm having trouble figuring out
I'm having some troubles adding an UIView to cocos2d v2.0 since the openGlView is
guys am having some troubles with running out of memory when displaying an animation
I'm having some troubles using Session Variables as they are being used as Reference
I am using VS2012 and having some troubles publishing an mvc4 website. None of
I'm developing a website in WordPress and I'm having some troubles with the the
I want to find a struct in a vector, but I'm having some troubles.
I'm just getting started with LINQ, and I'm having some troubles. Say I wanted
I know it's possible with jQuery, but I'm having some serious troubles with this
I have some troubles with a method having a typed List parameter, inherited from

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.