cakephp-upload plugin의 jose gonzalez를 사용하여 이미지를 Google 애플 리케이션에 업로드하고 있습니다. 기본적으로이 파일은 webroot/files/user/photo/{user_id}
과 같은 디렉토리에 저장됩니다. 단, 웹 루트/img 디렉토리의 이미지를 검색하는 $this->Html->image()
을 사용하여 이미지를 표시하려는 경우는 예외입니다.cakephp 업로드 플러그인 - 파일을 저장할 디렉토리 정의
이미 작동
echo $this->Html->image('../files/user/photo/' .
$user['User']['photo_dir'] . '/' .
$user['User']['photo']);
로 이미지를 표시하려했지만 IMG 디렉토리에 저장하려면이 플러그인을 알 수있는 방법이 있는지 궁금 해서요? 문서에 언급 된 내용이 없습니다.
또한 $this->Form->input('User.photo', array('type' => 'file'));
에게 이미지 파일 만 허용 할 수있는 방법이 있습니까? 당신이 accept
속성을 사용할 수 있습니다, 두 번째 질문에 대한
'path' => '{ROOT}webroot{DS}img{DS}'
과 : 당신이 만드는 그것을 바꿀 수
public $defaults = array(
'rootDir' => null,
'pathMethod' => 'primaryKey',
'path' => '{ROOT}webroot{DS}files{DS}{model}{DS}{field}{DS}',
...
:이 file에서 볼 수