I’m uploading my files to a web storage service so I don’t need to store them in my server. I want to store them in a temporary folder but also use Codeigniter’s uploading class for its security validation and filename encryption.
I tried this in the config
$config['upload_path'] = $_FILES['userfile']['tmp_name'];
$this->load->library('upload', $config);
$this->upload->do_upload();
but I get the wrong upload path error. Is it possible to upload temporary files without creating my own uploading class?
There is no built-in temporary file handling in CodeIgniter. You will have to build that yourself. It is up to you to write the logic for handling the uploaded file, manipulating/verifying it, and deleting it off of your server.
If you hold onto the path where the file gets uploaded, you can use PHP’s
unlink()function to delete the file after you’re done verifying/manipulating it.