Welcome Guest, Not a member yet? Register   Sign In
file upload class - problem with file_name config item
#1

[eluser]Berik[/eluser]
Hi there,

Not sure if this is a bug or a misunderstanding on my part but when initialising the upload class with the file_name config item, the uploaded file is not renamed to what I feed it (it keeps the original file name).

Here's my upload function (within a controller):

Code:
function _upload()
    {
        $config['allowed_types'] = 'jpg|jpeg|gif|png';
        $config['upload_path'] = './uploads/';
        $config['file_name'] = 'name_of_file';
        $config['overwrite'] = FALSE;

        $this->load->library('upload', $config);
        if( ! $this->upload->do_upload('files'))
        {
            var_dump($this->upload->display_errors());
            exit;
        }

        // all ok, return file upload data
        $file_data = $this->upload->data();
        return $file_data;
    }

Any clue on what I could be doing wrong?


Messages In This Thread
file upload class - problem with file_name config item - by El Forum - 05-28-2010, 02:20 AM
file upload class - problem with file_name config item - by El Forum - 05-28-2010, 03:12 AM
file upload class - problem with file_name config item - by El Forum - 05-28-2010, 03:22 AM
file upload class - problem with file_name config item - by El Forum - 05-28-2010, 03:30 AM
file upload class - problem with file_name config item - by El Forum - 05-28-2010, 05:18 AM
file upload class - problem with file_name config item - by El Forum - 05-28-2010, 11:45 AM
file upload class - problem with file_name config item - by El Forum - 05-30-2010, 02:40 AM
file upload class - problem with file_name config item - by El Forum - 08-02-2010, 02:13 AM
file upload class - problem with file_name config item - by El Forum - 08-02-2010, 03:24 PM



Theme © iAndrew 2016 - Forum software by © MyBB