I want copy file to folder in laravel. when I copy file show me this error
The second argument to copy() function cannot be a directory
My code:
$success = \File::copy(base_path('test.text'),base_path('public/'));
The error says what it means. If you read the docs on the copy() function it states you must copy from a file to a new file. Eg copying content from a .txt file to another.txt file.
So just add test.text after the public part and it will create a new file or overwrite an existing one.
$success = \File::copy(base_path('test.text'),base_path('public/test.text'));