/**
  * Saves the uploaded file.
  *
  * This method can throw exceptions if there is a problem when saving the file.
  *
  * If you don't pass a file name, it will be generated by the generateFilename method.
  * This will only work if you have passed a path when initializing this instance.
  *
  * @param  string $file      The file path to save the file
  * @param  int    $fileMode  The octal mode to use for the new file
  * @param  bool   $create    Indicates that we should make the directory before moving the file
  * @param  int    $dirMode   The octal mode to use when creating the directory
  *
  * @return string The filename without the $this->path prefix
  *
  * @throws Exception
  */
 public function save($file = null, $fileMode = null, $create = true, $dirMode = 0777)
 {
     if ($file === null) {
         if ($this->originalName === null) {
             $file = $this->generateFilename();
         } else {
             $file = $this->originalName;
         }
     }
     $filebase = $this->manager->getFilebase();
     // copy the temp file to the destination file
     $file = $filebase->getFilebaseFile($this->getTempName())->copy($file, true);
     // chmod our file
     if ($fileMode !== null) {
         $file->chmod($fileMode);
     }
     $this->savedName = $file->getPathname();
     return $file;
 }
 /**
  * Returns the mime type of a file.
  *
  * This methods call each mime_type_guessers option callables to
  * guess the mime type.
  *
  * Proxy for sfFilebasePluginFile::getMimeType()
  * 
  * @see sfFilebasePluginFile::getMimeType()
  * @param  string $file      The absolute path of a file
  * @param  string $fallback  The default mime type to return if not guessable
  * @return string The mime type of the file (fallback is returned if not guessable)
  */
 protected function getMimeType($file, $fallback)
 {
     return $this->manager->getFilebase()->getFilebaseFile($file)->getMimeType($fallback);
 }