Open riscphree opened 11 years ago
How are you setting your filename(s)? Can you post your code?
I'm setting like this:
$file_name = md5(time());
$config['file_name'] = $file_name.".png";
and then doing regular upload as such:
$this->load->library('upload', $config);
if(!$this->upload->do_multi_upload($field_name)){
// failed
$error = array('error' => $this->upload->display_errors());
}else{
etc, etc
Try passing the filename through as an array - $config["file_name"] = array("{$file_name}.png"). Let me know if this helps.
That seems to have worked. Why does that work and not simple setting it like normal?
That's a very good question!
It's looking for an array of filenames because there's the potential for more than one file and filename. The library does fallback to the native do_upload() method if only a single file is uploaded but doesn't set the singular filename override for it (see lines 77-93). I'll see if I can come up with a update to make it a little more intelligent when falling back.
When trying to set new filename for uploads (single and multiple) setting the CI config 'file_name' it doesn't seem to work with this. Instead it rather uses the original file names and won't allow me to set my own filenames :(