madala's avatar

file upload path

Hi,

when i tried to upload file it is uploaded to the directory which is configured in php.ini. how to configure in laravel to upload to public directory.

0 likes
3 replies
jlrdw's avatar
$file = Input::file('ufile');
            $file_name = $file->getClientOriginalName();
            $file_ext = $file->getClientOriginalExtension();
            $fileInfo = pathinfo($file_name);
            $filename = $fileInfo['filename'];
            $newname = $filename . $lid . "." . $file_ext;
            $destinationPath = ROOTDIR . 'upload/imgdogs/';
            //Input::file('ufile')->move($destinationPath, $newname);
            $file->move($destinationPath, $newname);
///////////more code ////////////////////////////////////////////

ROOTDIR is a constant I made for me doesn't apply to you.

AddWebContribution's avatar

You should update below code in your destination path

$destinationPath = public_path('upload/imgdogs/);

Hope it's useful for you !

Please or to participate in this conversation.