jeudi 31 mars 2022

upload file with laravel

I´m trying upload one file to storage/app with laravel for this, i´m checking that my folder exist:

if(isset($request->file_job)){
            $pathFolder = storage_path('app/contratos/'.$tarea->contratoTrey->serie->SERIE.'-'.$tarea->contratoTrey->N_CONTRATO.'/tareas/T-'.$tarea->ntarea);
           
            if(!\File::exists($pathFolder)) {
                \File::makeDirectory($pathFolder, 0755, true, true);
            }


            $filePath = 'app/contratos/'.$tarea->contratoTrey->serie->SERIE.'-'.$tarea->contratoTrey->N_CONTRATO.'/tareas/T-'.$tarea->ntarea;
            \Storage::disk('local')->put($filePath, $request->file_job);
        }

if not exist i´m building my structure folder and put my file in this folder.

My problem it´s in my DB i´m insert my file name with getClientOriginalName() but in this route

'app/contratos/'.$tarea->contratoTrey->serie->SERIE

my app was builded a file, not directory and in this directory my file with his original name...

i don´t know that i´m doing wrong.. i trayed creating a new variable with this name and save... same error or problem...

Thanks for readme and help me. Sorry for my bad english



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

Aucun commentaire:

Enregistrer un commentaire