| Server IP : 103.48.194.25 / Your IP : 216.73.217.33 Web Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.33 System : Linux VMHostDefault 3.10.0-1160.42.2.el7.x86_64 #1 SMP Tue Sep 7 14:49:57 UTC 2021 x86_64 User : sieuthimay ( 1016) PHP Version : 8.2.20 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/khonguyenlieu.vn/public_html/webadmin/models/ |
Upload File : |
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class editor_model extends CI_Model
{
function __construct()
{
parent::__construct();
}
function getAllFile($num,$offset)
{
//$ar_img = array('gif','png','jpg','jpeg');
//$this->db->where_in('ext',$ar_img);
$this->db->order_by('img_id','DESC');
$query = $this->db->get('sys_images',$num,$offset);
return $query->result();
}
function getNumFile()
{
$query = $this->db->get('sys_images');
return $query->num_rows();
}
function upload()
{
$this->load->library('upload_library');
$size = $_FILES["filedata"]["size"];
if($size > 0)
{
$filedata = $this->upload_library->uploadfile();
if($filedata!='')
{
$file = explode('*',$filedata);
$url = $file[0];
$size = $file[1];
$ext = $file[2];
$data = array(
'lb_name' => $file[3],
'lb_url' => $url,
'ext' => $ext,
'dt_create' => date('Y-m-d H:i:s')
);
$this->db->insert('sys_images',$data);
return $url;
}
}else{
return '';
}
}
}
?>