Welcome Guest, Not a member yet? Register   Sign In
Getting uri-> segment on swfupload for model (database purpose) return nothing ?
#1

[eluser]Triple_vent[/eluser]
Hi...all
i got this http://ellislab.com/forums/viewthread/70611/#419535 (thanks for Merolen) related to how to use the SWFuploader in CI, but i got some issues, coz in that thread it just for uploading, when i adding new line on my do_upload() function to get the uri->segment from my address it return nothing...

is there any others method to get the uri before uploading (with .swf) conducted ?

the address of my page :
Code:
http://localhost/ci/index.php/aset/gallery_new/25

my controller
Code:
class Upload extends Controller {
    
    function Upload()
    {
        parent::Controller();
        
        
       [i] $id=$this->uri->segment(3);[/i]
        
        
        $m='./uploads/'.$id;
        $config['upload_path'] = $m;
        $config['allowed_types'] = 'gif|jpg|png';
        $config['max_size']    = '1000';
        $config['max_width']  = '1024';
        $config['max_height']  = '768';
        
        $this->load->library('upload', $config);
    }
    
    function do_upload()
    {
        $this->upload->do_upload('Filedata');
        $res = $this->upload->data();

        echo $res['file_name'];
    }

Thanks for any help
#2

[eluser]Triple_vent[/eluser]
my fools, this can be done easily....just add the
Code:
post_params: {"id" : "<?php echo $id ?>"},
on the swf scripts on the view, then catch that with
Code:
$id=$_POST["id"];


What a shamed this solved by myself by just reading other example source code
By the way thanks for reading my messages




Theme © iAndrew 2016 - Forum software by © MyBB