2016-10-18 5 views
0

FMFlinderBundle v.5 (최신 버전을 사용할 수없는 몇 가지 이유로)를 Symfony 2.8.12와 함께 사용하고 있습니다. 나는 문서를 따라 갔고 큰 파일 (최대 20MB)을 업로드 할 수있는 요청이있을 때까지 제대로 작동했습니다. upload_max_size 매개 변수를 20M으로 변경했는데 괜찮 았지만 업로드하는 동안 파일이 2MB 덩어리로 분할되어 elfinder가 임시 디렉토리에 저장하려고합니다. 문제는 거기에 액세스 할 수 없다는 것입니다. 그것은 가상 호스트 정의에서 설정을 읽지 않습니다, 그것은 항상 시스템 임시 폴더를 사용합니다.FMElfinderBundle 5 - 업로드 할 임시 폴더를 설정하는 방법

설명서 읽기 나는 elfinder 임시 디렉토리 구성에 두 개의 매개 변수 - upload_temp_pathcommon_temp_path을 사용할 수 있음을 발견했습니다. 그러나 나는 그들을 세우는 것에 운이 없었습니다. PHPStorm 콘솔 명령 캐시에서 실행할 때마다 : clear --no-warmup InvalidConfigurationException이 발생합니다.

필자는 fm_elfinder 키 아래 config 구조체의 다른 곳에 매개 변수를 넣으려고했으나 동일한 예외가 여전히있었습니다.

config.yml 내 구성입니다 :


    fm_elfinder: 
     instances: 
      default: 
       locale: %locale% 
       editor: ckeditor 
       fullscreen: true 
       theme: smoothness 
       include_assets: true 
       relative_path: false 
       connector: 
        roots: 
         uploads: 
          driver: LocalFileSystem 
          path: uploads 
          upload_max_size: 20M 

누구든지 나를 도울 수 제발, 어떻게 임시 디렉토리를 설정하는 방법?

답변

0

그래, 해결책을 찾았습니다. yoour 사용자 지정 구성 판독기를 만들고 원래 구성 판독기를 바꿔야합니다. 구성 클래스는 ElFinderConfigurationProviderInterface를 구현해야합니다. 자세한 내용은 [https://github.com/helios-ag/FMElfinderBundle/blob/master/Resources/doc/advanced-configuration.md#custom-configuration-provider][1]을 참조하십시오. 좋아

+0

당신이 ElfinderConfigurator 클래스에 대한 당신의 결과를 공유하는 신경 수 있을까요? 나는 유효한 옵션이 반환 된 것에 대해 고심하고있다. 감사합니다. – Overdose

+0

원활하게 작동합니다 - 다른 답변에 일부 데이터를 입력합니다. 덕분에 – Trasher

1

, 일부 상세 정보 :

내가 ElFinder 번들에서 ElFinderConfigurationReader했다 및 이름 ElFinderConfigurationCustomReader에서 내 프로젝트에 저장된. 그런 다음이 클래스 i를 서비스로 정의했습니다.

service.custom_fm_elfinder.configurator: 
    class: CSBN\SVJBundle\Component\ElFinder\ElFinderConfigurationCustomReader 
    arguments: ['%fm_elfinder%', '@request_stack', '@service_container', '%elfinder_temporary_path%'] 

변수 elfinder_temporary_path가 parameters.yml에 설정되었습니다.

$options['uploadTempPath'] = $this->temporaryPath; 

서비스에서 가져온 것입니다

fm_elfinder: 
configuration_provider: service.custom_fm_elfinder.configurator 

그리고 내 새로 생성 된 파일 ElFinderConfigurationCustomReader에

난 그냥 방법으로는, getConfiguration 한 행을 추가 : config.yml에서

내가 내 자신의 구성 판독기를 설정 생성자의 매개 변수.

희망이 도움이됩니다.

편집 : 전체 기능 사본 :

/** 
* @param $instance 
* 
* @return array 
*/ 
public function getConfiguration($instance) 
{ 
    $request    = $this->requestStack->getCurrentRequest(); 
    $efParameters   = $this->parameters; 
    $parameters    = $efParameters['instances'][$instance]; 
    $options    = array(); 
    $options['corsSupport'] = $parameters['cors_support']; 
    $options['debug']  = $parameters['connector']['debug']; 
    $options['bind']  = $parameters['connector']['binds']; 
    $options['plugins']  = $parameters['connector']['plugins']; 
    $options['uploadTempPath'] = $this->temporaryPath; 
    $options['roots']  = array(); 

    foreach ($parameters['connector']['roots'] as $parameter) { 
     $path  = $parameter['path']; 
     $homeFolder = $request->attributes->get('homeFolder'); 
     if ($homeFolder !== '') { 
      $homeFolder = '/'.$homeFolder.'/'; 
     } 

     $driver = $this->container->has($parameter['driver']) ? $this->container->get($parameter['driver']) : null; 

     $driverOptions = array(
      'driver'   => $parameter['driver'], 
      'service'   => $driver, 
      'glideURL'   => $parameter['glide_url'], 
      'glideKey'   => $parameter['glide_key'], 
      'plugin'   => $parameter['plugins'], 
      'path'    => $path.$homeFolder, //removed slash for Flysystem compatibility 
      'startPath'   => $parameter['start_path'], 
      'URL'    => $this->getURL($parameter, $request, $homeFolder, $path), 
      'alias'    => $parameter['alias'], 
      'mimeDetect'  => $parameter['mime_detect'], 
      'mimefile'   => $parameter['mimefile'], 
      'imgLib'   => $parameter['img_lib'], 
      'tmbPath'   => $parameter['tmb_path'], 
      'tmbPathMode'  => $parameter['tmb_path_mode'], 
      'tmbUrl'   => $parameter['tmb_url'], 
      'tmbSize'   => $parameter['tmb_size'], 
      'tmbCrop'   => $parameter['tmb_crop'], 
      'tmbBgColor'  => $parameter['tmb_bg_color'], 
      'copyOverwrite'  => $parameter['copy_overwrite'], 
      'copyJoin'   => $parameter['copy_join'], 
      'copyFrom'   => $parameter['copy_from'], 
      'copyTo'   => $parameter['copy_to'], 
      'uploadOverwrite' => $parameter['upload_overwrite'], 
      'uploadAllow'  => $parameter['upload_allow'], 
      'uploadDeny'  => $parameter['upload_deny'], 
      'uploadMaxSize'  => $parameter['upload_max_size'], 
      'defaults'   => $parameter['defaults'], 
      'attributes'  => $parameter['attributes'], 
      'acceptedName'  => $parameter['accepted_name'], 
      'disabled'   => $parameter['disabled_commands'], 
      'treeDeep'   => $parameter['tree_deep'], 
      'checkSubfolders' => $parameter['check_subfolders'], 
      'separator'   => $parameter['separator'], 
      'timeFormat'  => $parameter['time_format'], 
      'archiveMimes'  => $parameter['archive_mimes'], 
      'archivers'   => $parameter['archivers'], 
     ); 

     if ($parameter['volume_id'] > 0) { 
      $driverOptions['id'] = $parameter['volume_id']; 
     } 

     if (!$parameter['show_hidden']) { 
      $driverOptions['accessControl'] = array($this, 'access'); 
     }; 

     $options['roots'][] = array_merge($driverOptions, $this->configureDriver($parameter)); 
    } 

    return $options; 
} 
+0

. 귀찮은 ElFinderConfigurationCustomReader 일뿐입니다. 여러분은'public function getConfiguration ($ instance) {$ options [ 'uploadTempPath'] = $ this-> temporaryPath; ... $ options;}'를 반환합니까? 전체 getConfiguration() 메소드를 넣을 수 있습니까? 다시 고마워. – Overdose

+0

이전 글에 – Trasher

+0

고마워. 마지막으로. 당신의'$ this-> getURL ($ 매개 변수, $ 요청, $ homeFolder, $ 경로),'메소드는 무엇입니까? 또한'$ this-> configureDriver ($ parameter)'내 문제는 내 이미지가 표시되지 않는다는 것인데, 단지 엘파 인더 아이콘이다.그들은 존재하고 올바르게 업로드되었지만 삽입 할 수는 없습니다. 나는 이것이 url/path 문제라고 생각한다. 그게 바로 제가 일하는 해결책을 요구하는 이유입니다. 내가 당신의 주제를 오염 시킨다면 미안 : '( – Overdose

관련 문제