I have a form and I want to upload text file and then read it and display the content on a textarea. The text is just a temp file so I don't want to save it.
Currently I am using the upload library like this
PHP Code:
$config['allowed_types'] = 'txt';
$config['max_size'] = '100';
$this->load->library('upload', $config);
$this->upload->initialize($config);
if ( ! $this->upload->do_upload()){
$data['error'] = $this->upload->display_errors();
}
else{
$text_file = $this->upload->data();
$data['$content'] = file_get_contents($text_file);
echo "success";
}
I didn't specify the upload path in the config and want to only save the text to the temp folder. But that doesn't seems to work as it complains about invalid upload path.