jeudi 25 août 2016

How to save the full path of file upload in php?

I am using Laravel and I have a form that uploading a file. And I want to save the full path of that file in my database. Do you know how?

if($request->hasFile('alternate_add_file_path')) {
        $file = $request->file('alternate_add_file_path');
        $destination = 'files/';
        $extension = $file->getClientOriginalExtension();
        $file_name =  $getCreateDate . '_' . str_replace('/','_',$M_USER_NAME) . '.' . $extension;
        $file->move($destination, $file_name );
}

This below is for the save into database

$M_FILE_PATH = $file_name;

I do not have an error though, just only the filename which saved into my database, not the full path.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire