[eluser]drewbee[/eluser]
In looking through the upload class code, you either have the option to randomize the name or use the original uploaded name. Unfortunately there doesn't appear to be way to set the filename as $this->filename is changed during the do_upload method. Extend it and do it your own way!
What I may suggset is extending the do_upload function.
Notice:: PSUDO CODE, most likely will not work. This is for a general idea of what needs to be done.
Code:
function do_upload($filename)
{
$status = parent::do_upload();
if ($status == TRUE)
{
// rename previously uploaded file
rename ($this->uploadpath . $this->filename, $this->uploadpath . $filename);
return TRUE;
}
else
{
return FALSE;
}
}
This is an easy fix to it.
Unfortunately we do double the work to complete this. (putting file then renaming). Ideally it would be better to rename it before the put. The only viable way I see doing this though is extending do_upload with practically the same code except the ability to pass a new file name to it.