Cakephp을 프레임 워크로 사용하고 있습니다. 양식을 통해 파일을 업로드하는 데 문제가 있습니다. THIS 웹 사이트의 업 로더 플러그인을 사용하고 있습니다.Cakephp 파일 업로드 문제
내 PHP INI 파일에이 코드가 있습니다.
upload_max_filesize = 10M
post_max_size = 8M
이
이 uploader.php에서입니다 - 플러그인 파일 내 controller.php 파일에서var $maxFileSize = '5M'; //default max file size
있다>, 내가 런타임에 1메가바이트로 최대 파일 크기를 설정하려면이 코드를 사용합니다. uploader.php에서
function beforeFilter() {
parent::beforeFilter();
$this->Uploader->maxFileSize = '1M';
}
, 우리는 ...이 수행
if (empty($this->maxFileSize)) {
$this->maxFileSize = ini_get('upload_max_filesize'); //landmark 1
}
$byte = preg_replace('/[^0-9]/i', '', $this->maxFileSize);
$last = $this->bytes($this->maxFileSize, 'byte');
if ($last == 'T' || $last == 'TB') {
$multiplier = 1;
$execTime = 20;
} else if ($last == 'G' || $last == 'GB') {
$multiplier = 3;
$execTime = 10;
} else if ($last == 'M' || $last == 'MB') {
$multiplier = 5;
$execTime = 5;
} else {
$multiplier = 10;
$execTime = 3;
}
ini_set('memore_limit', (($byte * $multiplier) * $multiplier) . $last);
ini_set('post_max_size', ($byte * $multiplier) . $last); //error suspected here
ini_set('upload_tmp_dir', $this->tempDir);
ini_set('upload_max_filesize', $this->maxFileSize); //landmark 2
예상 결과 : 내가 크기 2MB의있는 파일을 업로드하려고 할 때 , 그것은 MAXFILESIZE 때문에 이루어지지한다 런타임에 1MB입니다. 따라서 업로드가 실패해야합니다.
문제 : 하지만 업로드 중입니다.
랜드 마크 1이 실행되지 않습니다. (의견에서) ... 토지 마크 2가 작동하지 않는 것 같습니다 ... upload_max_filesize는 maxFileSize에서 값을 가져 오지 않습니다.
좀 도와주세요 ... 스크립트 파일을 실행 시간에 의해 이미 업로드되고 서버에서 허용 한 이후