php - Laravel - How to change upload file path


I need to upload images to folder project images.

My project structure folder in share host is this:

- css
- images
- fonts
- js
- laravel-code
- .htaccess

Insidelaravel-code folder are the remaining files.

The site work well, show images well but when i upload a new image it save the image inlaravel-code/ and create this folderspublic/images ...

I want to save images in image folder at root directory.

How can I do that?

When I do an upload file it detects if it was a pdf or other file; if it was pdf saves file on storage folder, if it other file (images) save in images folder. This is my code... I think I cannot usepublic_path

if (false === stripos($name, '-pdf')) {
    $basePath = trim(public_path(), '/');
    $newPath = trim(public_path('images'), '/');
} else {
    $basePath = trim(storage_path(), '/');
    $newPath = trim(storage_path(), '/');

People are also looking for solutions to the problem: PHP Webservice using nuSoap and mySQL


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.