mercredi 31 août 2022

i want to create directory with the name of the Company and i want to move some files related to that Company in that directory. How can i do it?

I successfully created the directories with this code in controller:

$cpath = public_path().'/files/completed/'.$file['customer_name'];
                if (! File::exists($cpath)) {
                    File::makeDirectory($cpath);
                }

but I am not sure how can i move related files to these directories for that I tried this:

File::move('files/pending/'.$filename,'files/completed/'.$file['customer_name'].$filename);

but the problem is I am not getting any files in their respective directories but the files are moving with the name renamed to (comapanyname filename.850) and that's not what I wanted here is how i am doing all the code in controller for directories and files:

 $cpath = public_path().'/files/completed/'.$file['customer_name'];
                if (! File::exists($cpath)) {
                    File::makeDirectory($cpath);
                }
       File::move('files/pending/'.$filename,'files/completed/'.$file['customer_name'].$filename);

Thank you for your response!



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/CiaYSqK
via IFTTT

Aucun commentaire:

Enregistrer un commentaire