Welcome Guest, Not a member yet? Register   Sign In
Uploading text file without saving?
#1

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.
Reply


Messages In This Thread
Uploading text file without saving? - by sing - 02-14-2019, 08:13 PM
RE: Uploading text file without saving? - by sing - 02-14-2019, 11:32 PM



Theme © iAndrew 2016 - Forum software by © MyBB