public function delete()
 {
     // try to delete the thumbnail if exists
     try {
         $thumbnail = $this->getThumbnail();
         if ($thumbnail) {
             $thumbnail->delete();
         }
     } catch (sfException $e) {
     }
     // delete current file
     parent::delete();
 }
 public function executeRename(sfWebRequest $request)
 {
     $file = new sfMediaBrowserFileObject($request->getParameter('file'));
     $name = sfMediaBrowserStringUtils::slugify(pathinfo($request->getParameter('name'), PATHINFO_FILENAME));
     $ext = $file->getExtension();
     $valid_filename = $ext ? $name . '.' . $ext : $name;
     $new_name = dirname($file->getPath()) . '/' . $valid_filename;
     $error = null;
     try {
         $renamed = rename($file->getPath(), $new_name);
     } catch (Exception $e) {
         $error = $e;
     }
     if ($request->isXmlHttpRequest()) {
         sfContext::getInstance()->getConfiguration()->loadHelpers(array('I18N'));
         if ($error) {
             $reponse = array('status' => 'error', 'message' => __('Some error occured.'));
         } elseif ($renamed) {
             $response = array('status' => 'notice', 'message' => __('The file was successfully renamed.'), 'name' => $valid_filename, 'url' => dirname($file->getUrl()) . '/' . $valid_filename);
         } elseif (file_exists($new_name)) {
             $response = array('status' => 'error', 'message' => __('A file with the same name already exists in this folder.'));
         } else {
             $response = array('status' => 'error', 'message' => __('Some error occured.'));
         }
         return $this->renderText(json_encode($response));
     }
     $this->redirect($request->getReferer());
 }
 public function cleanFolder($folder)
 {
     return parent::cleanFolder($folder);
 }