1
이미지 업로드를 도우미로 만들려고합니다. 사용자 정의 도우미에서 라이브러리를 확장 할 수 있습니까? 나는 그것을 사용하려고 시도했으나 결코 작동하지 않습니다.은 codeigniter의 사용자 정의 도우미 확장 라이브러리를 사용할 수 있습니다.
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
function FileUploadd($r)
{
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '100';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);
if (! $this->upload->do_upload($r))
{
echo $this->upload->display_errors();
}
else
{
$Dder=$this->upload->data();
return $Dder['file_name'];
}
}
글을 올리는 방법을 게시하고, 어떤 오류가 발생합니까? 감사합니다 – chad
function FileUploadd ($ name_file) { $ config [ 'upload_path'] = './uploads/'; \t \t $ config [ 'allowed_types'] = 'gif | jpg | png'; \t \t $ config [ 'max_size'] \t = '100'; \t \t $ config [ 'max_width'] = '1024'; \t \t $ config [ 'max_height'] = '768'; $ ci = & get_instance(); \t \t $ ci-> load-> library ('upload', $ config); \t \t 경우 (C1 내지 $> upload-> do_upload의 ($ name_file)) { \t \t \t \t \t 은 (C1 내지 $> upload-> display_errors를 에코); 다른 \t \t \t \t} \t \t $ {Dder = $ C1-6 알킬> upload-> 데이터(); return $ Dder [ 'file_name']; } // 컨트롤러에 있음 – NewPhpProgramer101