title: How can we save number of AudioRecorded files(.caf) in sqlite3 database
body: <p>I am developing one app in that i want to record user voice for that i have record the voice in NSTemporaryDirectory() but after coalition of record i want to save that recorded .caf file   in database and also retrieve that file from database and play that file so help  me...
  I am do like this...</p>
  
  <pre><code>-(IBAction)recordbutton:(id)sender
  {
      if(toggle)
      {
  
          toggle = NO;
          [btnStart setImage:[UIImage imageNamed:@"stopbtn.png"] forState:UIControlStateNormal];
          label1.text = @"Speak now";
  
          dotimageview.image = [UIImage imageNamed:@"record_dot.png"];
          timer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(hideLabel:) userInfo:nil repeats:YES];
  
          btnPlay.enabled = toggle;
          btnPlay.hidden = !toggle;
  
          //Begin the recording session.
          //Setup the dictionary object with all the recording settings that this 
          //This is a good resource: http://www.totodotnet.net/tag/avaudiorecorder/
          NSMutableDictionary* recordSetting = [[NSMutableDictionary alloc] init];
          [recordSetting setValue :[NSNumber numberWithInt:kAudioFormatAppleIMA4] forKey:AVFormatIDKey];
          [recordSetting setValue:[NSNumber numberWithFloat:44100.0] forKey:AVSampleRateKey]; 
          [recordSetting setValue:[NSNumber numberWithInt: 2] forKey:AVNumberOfChannelsKey];
  
          //Now that we have our settings we are going to instanciate an instance of our recorder instance.
          //Generate a temp file for use by the recording.
          //This sample was one I found online and seems to be a good choice for making a tmp file that
  //      recordedTmpFile = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent: [NSString stringWithFormat: @"%.0f.%@", [NSDate timeIntervalSinceReferenceDate] * 1000.0, @"caf"]]];
  
          recordedTmpFile = [NSURL fileURLWithPath:[NSHomeDirectory() stringByAppendingPathComponent: [NSString stringWithFormat: @"%.0f.%@", [NSDate timeIntervalSinceReferenceDate] * 1000.0, @"caf"]]];
  
          NSLog(@"Using File called: %@",recordedTmpFile);
  
          //Setup the recorder to use this file and record to it.
          recorder = [[ AVAudioRecorder alloc] initWithURL:recordedTmpFile settings:recordSetting error:&amp;error];
  
          //Use the recorder to start the recording.
          [recorder setDelegate:self];
          [recorder prepareToRecord];
  
          //Start the actual Recording
          [recorder record];
          //There is an optional method for doing the recording for a limited time see 
          //[recorder recordForDuration:(NSTimeInterval) 29];
  
      }
      else
      {
          toggle = YES;
          label1.text = @"";
          btnPlay.enabled = toggle;
          btnPlay.hidden = !toggle;
  
          // stop the timer
          [timer invalidate];
          timer = nil;
          dotimageview.hidden = YES;
          label1.text = @"Listen";
          self.navigationItem.rightBarButtonItem.enabled = YES;
  
          NSLog(@"Using File called: %@",recordedTmpFile);
          NSString *soundFile = [NSString stringWithFormat:@"%@",recordedTmpFile];
          NSLog(@"str === %@",soundFile);
  
          //Stop the recorder.
          [recorder stop];
  
  
      }
  
  }
  </code></pre>