CodeIgniter Forums
Insert file in folder create a idindex.html - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Insert file in folder create a idindex.html (/showthread.php?tid=78750)



Insert file in folder create a idindex.html - pippuccio76 - 03-06-2021

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 ?


RE: Insert file in folder create a idindex.html - paulbalandan - 03-06-2021

The index.html file is created to prevent accidental leaking of the contents of the folder if viewed in the browser. If your server uses Apache, for example, then viewing the folder will just display the index.html file instead of listing the folder's contents.


RE: Insert file in folder create a idindex.html - pippuccio76 - 03-06-2021

(03-06-2021, 08:08 AM)paulbalandan Wrote: The index.html file is created to prevent accidental leaking of the contents of the folder if viewed in the browser. If your server uses Apache, for example, then viewing the folder will just display the index.html file instead of listing the folder's contents.

But ci dont create index.html but 1index.html 2index.html ecc a file for every user


RE: Insert file in folder create a idindex.html - iRedds - 03-06-2021

What version of CI are you using?
The issue has been fixed in version 4.0.5 / 4.1.0


RE: Insert file in folder create a idindex.html - pippuccio76 - 03-06-2021

(03-06-2021, 11:59 AM)iRedds Wrote: What version of CI are you using?
The issue has been fixed in version 4.0.5 / 4.1.0

My version is 4.0.4  Angry 

if i update can i solve ?

How can i update to the last version ?

this is my directory :

[Image: rcwr2pm.png]

I try to run composer update in codeigniter folder but in compser..json i havent codeigniter
can i manually download ci 4.1.0 and copy system folder in my project ?


RE: Insert file in folder create a idindex.html - iRedds - 03-06-2021

Could this solve your problem? I think it can.
If you were using Composer, then you could update like this
Code:
composer update --no-dev

If you installed CodeIgniter manually from the archive. Then you will have to manually update as well.

Note: If you have PHP 7.2, then you need CI version 4.0.5, if PHP 7.3 or newer, then 4.1.1.
Don't forget to look at Change Log.


RE: Insert file in folder create a idindex.html - pippuccio76 - 03-06-2021

(03-06-2021, 01:15 PM)iRedds Wrote: Could this solve your problem? I think it can.
If you were using Composer, then you could update like this
Code:
composer update --no-dev

If you installed CodeIgniter manually from the archive. Then you will have to manually update as well.

Note: If you have PHP 7.2, then you need CI version 4.0.5, if PHP 7.3 or newer, then 4.1.1.
Don't forget to look at Change Log.


i install from composeer but change folder as this : https://www.youtube.com/watch?v=k943H5OiIdE&t=881s but if i download the latest version as zip , must i overwrite system folder ? or other folder ?


RE: Insert file in folder create a idindex.html - iRedds - 03-06-2021

I'll be honest. What you've done with directories is a perversion. =)

Open your console and go to the codeigniter directory.
Update through the composer as I wrote above.


RE: Insert file in folder create a idindex.html - pippuccio76 - 03-06-2021

(03-06-2021, 04:14 PM)iRedds Wrote: I'll be honest. What you've done with directories is a perversion. =)

Open your console and go to the codeigniter directory.
Update through the composer as I wrote above.

with compuser-update :


[RuntimeException]                                           
  Failed to execute git status --porcelain --untracked-files=no 
                                                               
  fatal: unknown index entry format 0x496e0000

can i overwrite system directory or there is another way to update ?


RE: Insert file in folder create a idindex.html - iRedds - 03-06-2021

I would recommend resolving the issue with Composer so that there are no problems with updating in the future.

You can download the zip archive of the required version and update the system directory from it.

Or install it temporarily in a separate directory through the composer and also update the system directory.
In particular, the composer will install the version that is available to your system at the moment and check for the necessary extensions for php