Codeigniter : Config upload file and encrypt_name
Easy code to config on upload file in codeigniter
example code :
1 2 3 4 5 |
$config['upload_path'] = './uploads/'; $config['allowed_types'] = 'gif|jpg|png'; $config['max_size'] = '2000'; $config['max_width'] = '2000'; $config['max_height'] = '2000'; |
Description:
destination path for store the file
1 |
$config['upload_path'] = './uploads/'; |
allowed type file
image file
1 |
$config['allowed_types'] = 'gif|jpg|png'; |
video file
1 |
$config['allowed_types'] = 'mp4|3gp'; |
fix file size
1 2 3 |
$config['max_size'] = '2000'; $config['max_width'] = '2000'; $config['max_height'] = '2000'; |
Change name on upload file and encrypt_name
1 |
$config['encrypt_name'] = TRUE; |
example : uploade 1.jpg change the name as f9e02c630ba4338ab98b7ffccc821584.jpg