Reputation: 47
I want to create a sub folder to store the images which is captured by camera & also require to store images in to the database and retrieve the images From the database.
So please provide me help regarding how to create a folder in iPhone & how to store the images in to the database & retrieve them
Upvotes: 0
Views: 1620
Reputation: 51374
To create a directory in the documents folder,
- (void)createDirectoryInDocumentsFolderWithName:(NSString *)dirName {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *yourDirPath = [documentsDirectory stringByAppendingPathComponent:dirName];
NSFileManager *fileManager = [NSFileManager defaultManager];
BOOL isDir = YES;
BOOL isDirExists = [fileManager fileExistsAtPath:yourDirPath isDirectory:&isDir];
if (!isDirExists) [fileManager createDirectoryAtPath:yourDirPath withIntermediateDirectories:YES attributes:nil error:nil];
}
Upvotes: 7