store file in NSDocumentDirectory of iPhone
<p>I am using a UIImagePickerController in my application.</p>

<p>After selecting an image by user,</p>

<p>image should be saved at application Documents Directory,</p>

<p>my Code is Give Below.</p>

<pre><code>-(void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary*)info
{
     [picker dismissModalViewControllerAnimated:YES];
     NSData *imgData = UIImagePNGRepresentation([info objectForKey:@"UIImagePickerControllerOriginalImage"]);
     UIImage *img = [[UIImage alloc] initWithData:imgData];
     stuImgView.image = img;
     [img release];

     //write image
     NSString *imageFilename = [NSString stringWithFormat:@"%i.jpg", currentStudent.stuNo];
     NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
     NSString *path = [NSString stringWithFormat:@"%@/%@", [paths objectAtIndex:0], imageFilename];
     UIImage *stuImg; 
     BOOL success; 
     NSFileManager *fm=[NSFileManager defaultManager];
     // how to store file at documents dir????
}
</code></pre>

<p>i dont know how to use file manager to store a file?</p>

<p>Help me Out.</p>

<p>Thanks in advance.</p>
