Welcome Guest, Not a member yet? Register   Sign In
File upload not returning proper file name (dropping extension)
#1

[eluser]Pawel K[/eluser]
Hello, I am using $this->upload->data(); to get the full file path of the uploaded image. However, for some reason this returns the value without the .jpg extension. Any ideas on what could be going on?

Code:
#Perform Action
            else
            {
                #Set Upload Options
                $config_pic_up['upload_path'] = $this->config->item('cat_img_upload');
                $config_pic_up['allowed_types'] = 'gif|jpg|png';
                $config_pic_up['max_size']    = '3000';
                $config_pic_up['max_width']  = '4024';
                $config_pic_up['max_height']  = '3068';
                $config_pic_up['file_name']  = now();
                
                $this->load->library('upload', $config_pic_up);
                $image_info = $this->upload->data();
                
                $image_file_full = $image_info['full_path'];
                
                echo $image_file_full;
                
                chmod($image_file_full, 777);
                
                #Post Data
                $cat_name = $this->input->post('cat_name');
                $cat_topcat = $this->input->post('category');
                $cat_desc = $this->input->post('cat_desc');

In the above example the $image_info['full_path'] item displays:

/home/xxxxx/public_html/cart/images/category/1273687679

instead of the proper value:

/home/xxxxx/public_html/cart/images/category/1273687679.jpg

Any ideas would be appreciated.
#2

[eluser]Pawel K[/eluser]
Well figured it out. I wasn't calling the actual upload function, long day.
#3

[eluser]ysh[/eluser]
[quote author="Pawel K" date="1273718702"]Well figured it out. I wasn't calling the actual upload function, long day.[/quote]

Hey I'm gettinhg the same problem, what did you do?
If anybody else understands what this means let me know...
#4

[eluser]ysh[/eluser]
Resolved it. I have to call upload->do_upload before using upload->data()...




Theme © iAndrew 2016 - Forum software by © MyBB