Created
August 25, 2018 12:10
-
-
Save franklinokech/e0895be6472680645d3b839ad639d680 to your computer and use it in GitHub Desktop.
Code Snippet for uploading images in php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* file uploading */ | |
$config['upload_path'] = './uploads/intro/'; | |
$config['allowed_types'] = 'gif|jpg|png'; | |
$config['encrypt_name'] = true; | |
$this->load->library('upload', $config); | |
if ($this->upload->do_upload('file_to_upload')) | |
{ $file_data = $this->upload->data(); | |
` $file_name = $file_data['file_name']; | |
} | |
else | |
{ | |
$file_name = 'noimage.jpg'; | |
} | |
$data = array | |
( 'name' => $name, 'email' => $email, | |
'password' => base64_encode($password), | |
'mobile' => $mobile, | |
'file_name' => $file_name, | |
); | |
$this->intro_model->intro_insert($data); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment