How to rename multiple input file files?

Asked

Viewed 361 times

0

How to change the name of the files going to a particular directory ? This is my code;

$upload_files = $_FILES['files'];  

                // Inicia o array dos dados que serão inseridos
                $conf2 = array();

                // Varre o array com info. dos arquivos
                for ($i=0; $i < sizeof($upload_files); $i++) {

                    // Nome do arquivo em cada elemento
                    $new_name = $upload_files[$i]['name'];


                    //Configure upload.
                    $conf2[] = array(
                        "file_name" => $new_name,
                        "upload_path"   => './public/uploads/album/'. $past_date .'/'. $pasta .'/',
                        "allowed_types" => "mp3",
                        "max_size"  => "2194304000"
                    );

                    $this->upload->initialize($conf2);              
                }

I’m using the class Codeigniter-Multi-upload

  • You are using the Codeiginter?

  • Yes, with multiple upload class My_upload

  • I didn’t understand the question, rename only the files that go to a specific directory?

  • You cannot "rename the input file" files, but save the upload with a new name. In case, just take the file extension with the function pathinfo and create a new name, concatenating with the extension detected by the function pathinfo

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.