[eluser]alectrash[/eluser]
how do u rename file when its uploaded I followed the code in this tutorial n got it working but when i upload file i want to rename it? is this possible.
In my controller I have this
Code:
//load upload model
$this->load->model('upload_model');
$this->upload_model->avatar_upload('avatar_photo')
an in view file i have
Code:
<input type="file" name="avatar_photo" size="20" />
and in my model I have this
Code:
function avatar_upload()
{
//handle profile pic uploads
$directory = "/var/www/html/public/frontend/images/avatars";
$config['upload_path'] = $directory;
$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('avatar_photo'))
{
$error = array('error' => $this->upload->display_errors());
return FALSE;
}
else
{
return TRUE;
}
}
I want to put a line in the model somehwere that renames it if possible.