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
Inside laravel-code
folder are the remaining files.
The site work well, show images well but when i upload a new image it save the image in laravel-code/
and create this folders public/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 use public_path
if (false === stripos($name, '-pdf')) {
$basePath = trim(public_path(), '/');
$newPath = trim(public_path('images'), '/');
} else {
$basePath = trim(storage_path(), '/');
$newPath = trim(storage_path(), '/');
}