Welcome Guest, Not a member yet? Register   Sign In
File Uploader Class $config['file_name'] = to date & time of file upload
#1

[eluser]Unknown[/eluser]
HI, does anyone know how I can assign the current date & time to a file name when using the file upload class.

My current code is:

Code:
function do_upload()
        {
            $config['upload_path'] = './uploads/';
            $config['allowed_types'] = 'gif|jpg|png';
            $config['max_size'] = '2048';
            $config['max_width']  = '1624';
            $config['max_height']  = '1268';
            $config['file_name']  = substr(md5(time()), 0, 28);

            $this->load->library('upload', $config);

            if ( ! $this->upload->do_upload())
            {
                $error = array('error' => $this->upload->display_errors());

                //$this->load->view('upload_form', $error);
            }
            else
            {
                $data = array('upload_data' => $this->upload->data());

                $this->load->view('upload_success', $data);
            }
        }

Any help much appreciated.
#2

[eluser]scibuff[/eluser]
What sort of problems are you having? Looking at the Upload class, this should work...




Theme © iAndrew 2016 - Forum software by © MyBB