Welcome Guest, Not a member yet? Register   Sign In
Insert file in folder create a idindex.html
#1

Sorry for english this is my controller's method (working with ajax) :

PHP Code:
public function dropzone_documenti()
    {


        //recupero le informazioni del file
        $img $this->request->getFile('userfile');

        $targetDir FCPATH '/uploaded/xyz_xrh/documenti_personali_smart_card/'.$_SESSION['user_id'];


        //recupero tutti i valori via post
        $post $this->request->getPost();

        $post['nome_file_originale'] = $img->getName();



        //creo un nome casuale
        $newName =$post['id_smart_card'].'*documenti*'.time().'*'.$img->getName();

        //lo rinomino
        if($img->move($targetDir$newName)){

            //istanzio il model
            $smart_card_documenti_model = new Smart_card_documentiModel();

            $post['nome_file'] =$newName ;

            //inserisco i valori nel db
            $res=$smart_card_documenti_model->save($post);

            if(!$res){

                if(file_exists($file=$targetDir.'/'.$newName)){
                    unlink($file);
                }
            }

            $id_tabella $smart_card_documenti_model->getInsertID();
         }


            echo "{}";



    


the folder are creating automatically inside /uploaded/xyz_xrh/documenti_personali_smart_card/  with user's id , with folder are creating a file  "user's id"index.html (user's id is number ) why ?
Reply


Messages In This Thread
Insert file in folder create a idindex.html - by pippuccio76 - 03-06-2021, 03:41 AM



Theme © iAndrew 2016 - Forum software by © MyBB