0

I have made Laravel API, which works with Android. This project is integrated to php web project. Both project are hosted in same hosting, but are in different folder.

In web project, image is uploaded in web project folder, and from laravel api image is uploaded to it's project folder only. Now I want to upload image from laravel api to the other project's upload directory.

Image upload code:

                $imageName = $rand . $image . $userid . "." . $ext;

             $request->file('image_name')->move(
                 'http://corephp/webProject/upload/' . $year . "/" . $month , $imageName

            );

when tried to upload, the problem says: Unable to create the directory .

but this works for laravel directory only:

  $request->file('image_name')->move(
                base_path() . '/public/uploads/' . $year . "/" . $month, $imageName
            );

1 Answer 1

1

Change
'http://corephp/webProject/upload/' . $year . "/" . $month
To
base_path("../../corephp/webProject/upload/$year/$month")

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.