Welcome Guest, Not a member yet? Register   Sign In
Renaming file in upload

Hello, I stuck in renaming file. What I have to do is:

$config['file_name'] = "file name" . "some word";

"file name" represents the actual name of the file

How can I get both names in one string that will be the new full name of the file in folder.


I am not sure if that is possible, cause the $config[] array must be set before the do_upload() method. So in that point, we don't have the file information yet, I guess that is the workflow.

I see two ways:

1) After the do_upload() method and if it succeed use the helper http://ellislab.com/codeigniter/user-gui...elper.html to manage the new file, knowing that we have the information related to it with this method $this->upload->data()

2) Easier is to have a hidden input in the view and catch the filename of the file the user selected with Javascript, and then in the controller before setting and loading the library - $this->load->library('upload', $config); - we can have the filename and add it to $config[] array.

Theme © iAndrew 2016 - Forum software by © MyBB