The Rock
The Rock

Reputation: 413

How to upload image from one project to another project laravel

I have two laravel project i use code in my Myfirstproject to upload to Mysecondproject public\src\img\upload directory.

I try these code in Myfirstproject:

if ($request->hasFile('images')) {
         $destinationPath='Mysecondproject\public\src\img\upload';
            if ($files = $request->file('images')) {
                foreach ($files as $file) {
                    $name = $file->getClientOriginalName();
                    $file->move($destinationPath, $name);
                    $images[] = $name;
                }
           }
      }

But it's not working, any solution for these?

Upvotes: 1

Views: 1944

Answers (1)

Kamal Soni
Kamal Soni

Reputation: 1552

Please try absolute path in $destinationPath as C:\Mysecondproject\public\src\img\upload or D:\Mysecondproject\public\src\img\upload.

Upvotes: 2

Related Questions