Welcome Guest, Not a member yet? Register   Sign In
Extracting string from between two strings multiple times..
#6

[eluser]ProImage Web[/eluser]
Finally got past the loop! Smile

Code:
function do_upload()
    {
        $config['upload_path'] = './uploads/';
        $config['allowed_types'] = 'html|txt|js|css';;
        $config['max_size']    = '1024';
        $config['max_width']  = '1280';
        $config['max_height']  = '1024';
        $config['max_filename'] = '60';
        $config['remove_spaces'] = TRUE;

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

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

            $this->themes->view('home', $error);
            
        } else {
            
            $filename = $this->upload->file_name;
            $file_path = './uploads/';
            $write_path ='./uploads/data.php';
            $orig_name = $this->upload->orig_name;
            $start_string = $this->input->post('start_string');
            $stop_string = $this->input->post('stop_string');
            
            $data = read_file($file_path.$filename);
            $lines = explode("\n", $data);
            
            $m = 0;
            foreach ($lines as $line){
                
                $deduct = strlen($start_string);
                $m++;
                $between[$m] = substr(substr($line, strpos($line, $start_string), strpos($line, $stop_string) - strpos($line, $start_string)), $deduct)."\n";
                echo $between[$m];
            }
            
        }
        
        
        //$this->themes->view('results', $result);
        
    }
Now I have to figure out how to get that array of results formatted to input into a write_file() function.. any ideas?


Messages In This Thread
Extracting string from between two strings multiple times.. - by El Forum - 06-28-2011, 02:03 PM



Theme © iAndrew 2016 - Forum software by © MyBB