Welcome Guest, Not a member yet? Register   Sign In
It's possible get the encrypted value using Upload class?
#1

[eluser]Unknown[/eluser]
Hi every:
I'm building a application and need some upload stuff. For this I use CI Upload Class but I have some questions about it. First take a look to this code:
Code:
$upload['encrypt_name'] = true;
$this->load->library('upload', $upload);
This generate a encrypted name for uploaded file as doc said. My problem is that with $this->upload->data() can't get this encrypted name for inserted after in the DB. Any knows if this is possible or how to solve this problem?
Cheers
#2

[eluser]oliviermarian[/eluser]
Late reply, but may help someone else (I was looking fo this answer and found this post).

my working code:

Code:
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size']    = '100';
$config['max_width']  = '1024';
$config['max_height']  = '768';
$config['encrypt_name']  = TRUE;
$this->load->library('upload', $config);

//try upload
if ( ! $this->upload->do_upload())
{
    // error
    $this->load->view('upload_form', $error);
}    
// HERE IS THE POINT
$uploaded_data = $this->upload->data();
$file = $uploaded_data['file_name'];

hope this helps
Olivier.




Theme © iAndrew 2016 - Forum software by © MyBB