Welcome Guest, Not a member yet? Register   Sign In
Upload path set to tmp folder
#1

[eluser]cyberjunkie[/eluser]
I'm using the upload library. I'm uploading my files to Amazon S3 and don't need to store them locally. I decided to set the file path to the tmp folder

Code:
$config['upload_path'] = '/tmp/';
$config['allowed_types'] = 'jpg|png';
$config['encrypt_name'] = TRUE;
$config['max_size'] = '1500';
//etc...
  
$this->load->library('upload', $config);

To my surprise this works. The file is saved to tmp and deleted after the script is executed. Are there any concerns uploading to tmp?

Looking in the uploading library I see that this code moves the tmp file to the upload path

Code:
*
   * Move the file to the final destination
   * To deal with different server configurations
   * we'll attempt to use copy() first.  If that fails
   * we'll use move_uploaded_file().  One of the two should
   * reliably work in most environments
   */
  if ( ! @copy($this->file_temp, $this->upload_path.$this->file_name))
  {
   if ( ! @move_uploaded_file($this->file_temp, $this->upload_path.$this->file_name))
   {
    $this->set_error('upload_destination_error');
    return FALSE;
   }
  }

in my case I don't need to do that since I'm already storing it in tmp. I'm thinking to delete that code.




Theme © iAndrew 2016 - Forum software by © MyBB