[eluser]Ben Edmunds[/eluser]
When specifying the file_name in the config array passed to the CI_Upload class it is overwritten in the do_upload method.
Corrected lines 188-201:
Code:
// Set the uploaded data as class variables
$this->file_temp = $_FILES[$field]['tmp_name'];
$this->file_size = $_FILES[$field]['size'];
$this->file_type = preg_replace("/^(.+?);.*$/", "\\1", $_FILES[$field]['type']);
$this->file_type = strtolower($this->file_type);
$this->file_ext = $this->get_extension($_FILES[$field]['name']);
if (!isset($this->file_name))
{
$this->file_name = $this->_prep_filename($_FILES[$field]['name']);
}
else
{
$this->file_name = $this->_prep_filename($this->file_name.$this->file_ext);
}