Unisharp\Laravelfilemanager\controllers\LfmController::getPath PHP Method

getPath() public method

public getPath ( $type = null, $get_thumb = false )
    public function getPath($type = null, $get_thumb = false)
    {
        $path = base_path() . '/' . $this->file_location;
        $path = $this->formatLocation($path, $type);
        return $path;
    }

Usage Example

 /**
  * @return string
  */
 public function getRename()
 {
     $old_name = Input::get('file');
     $new_name = trim(Input::get('new_name'));
     $file_path = parent::getPath('directory');
     $thumb_path = parent::getPath('thumb');
     $old_file = $file_path . $old_name;
     if (!File::isDirectory($old_file)) {
         $extension = File::extension($old_file);
         $new_name = str_replace('.' . $extension, '', $new_name) . '.' . $extension;
     }
     $new_file = $file_path . $new_name;
     if (Config::get('lfm.alphanumeric_directory') && preg_match('/[^\\w-]/i', $new_name)) {
         return Lang::get('laravel-filemanager::lfm.error-folder-alnum');
     } elseif (File::exists($new_file)) {
         return Lang::get('laravel-filemanager::lfm.error-rename');
     }
     if (File::isDirectory($old_file)) {
         File::move($old_file, $new_file);
         Event::fire(new FolderWasRenamed($old_file, $new_file));
         return 'OK';
     }
     File::move($old_file, $new_file);
     if ('Images' === $this->file_type) {
         File::move($thumb_path . $old_name, $thumb_path . $new_name);
     }
     Event::fire(new ImageWasRenamed($old_file, $new_file));
     return 'OK';
 }
All Usage Examples Of Unisharp\Laravelfilemanager\controllers\LfmController::getPath