NabeelHassan's avatar

file upload from one project into other on same server

i have two laravel project running on same sever i want to transfer files between them .is there any direct way to transfer files between them or i have to write an Api

0 likes
4 replies
jlrdw's avatar

Why not have a common directory for both projects for files that both projects will use. But yes you could just copy a file, why upload again? Just curious.

NabeelHassan's avatar

both projects are hosted on same domain and in the same diroctory ,basicaly scenario is one project is a website and the second one is admin panel of that website .and both have same database between them.what i want to do is whenever a file is uploaded on website project i want to store it in admin panel project not in website project

zeesamadram's avatar

Go to your config/filesystems.php inside the Admin, add the following lines

'new_public' => [ 'driver' => 'local', 'root' => storage_path('../../project_name/storage/app/public'), 'url' => env('APP_URL').'/storage', 'visibility' => 'public', 'throw' => false, ],

In your Controller, when you upload the file-> Storage::disk('new_public')->put($file_name, 'Contents');

.... Hope this solves your issue

Please or to participate in this conversation.