In my local project I save the images in the storage path and load normally with asset('storage/...');
Everything works smoothly. I do not have full access to the hosting to upload the project. only access via FTP, no ssh access. When the project is unpacked on the hosting, the storage link in the public folder brings all the files as a folder. I removed it and because I don't have ssh access I declared a route to execute the command.
Route::get('storage-link', function(){
Artisan::call('storage:link');
echo (Artisan::output());
});
When running the route, it even prints the message that it normally shows when the command is run in the console, saying that the link between the folders was created.
The problem is that the images do not load.
asset('/storage/cars/photo.jpg')
if I pass the folder to the public and call it without going through the link to the storage folder asset('/cars/photo.jpg') it shows it correctly.
I hope you can help me. Thanks in advance.
Related
I am struggling to wrap my head around the file storage in laravel. I setup the php artisan storage:link like it said to do online.
Then to store my images in my store method
$request->file('brandimage')->storeAs('/public/brandimages', $filename);
I tried doing it without the /public but it throws an error. This means when I want to delete the files I have to use
Storage::delete('public/' . $brand->brand_image_path);
(The brand_image_path is: thumbimages/thumb-post-5.jpg so it isnt adding any extra directories.
My issue is when transfer my site from local to my server none of my images show up. My project is looking for them at www.sitename.com/thumbimages/thumb-post-5.jpg but in order to actually see them I have to go to www.sitename.com/storage/thumbimages/thumb-post-5.jpg"
I'm guessing that it should work the same local as it does on the server so what part am I doing wrong?
I discovered that I should be using /storage/thumbimages/thumb-post-5.jpg" even when I am on local. /storage and not using /storage both work on local.
I need your help. I am trying to create folders on my FTP server through my Code Igniter web application. If the manager clicks attachments on projects a folder gets created if it doesn't exists yet and then through file upload he populates it with files.
I have achieved all this when running the code on localhost (the folders got created, and file upload worked too), however when I uploaded my app to a live site I couldn't create folders, so I googled a little and found out I should use the ftp library, because I couldn't create the folders with the relative paths I had.
However, I still cant seem to create the folder with the following code.
if($this->ftp->list_files('attachments/výkres'.$id) == FALSE)
{
$this->ftp->mkdir('attachments/'.$id);
}
I always get the error:
Unable to create the directory you have specified.
Hope this will help you :
use with full path with starting and ending slashes like this:
if($this->ftp->list_files('/public_html/your_path/attachments/yýkres'.$id.'/') == FALSE)
{
$this->ftp->mkdir('/public_html/your_path/attachments/'.$id.'/', DIR_WRITE_MODE);
}
for more : https://www.codeigniter.com/user_guide/libraries/ftp.html#CI_FTP::mkdir
I am using laravel 5.5 and my API URL is http://127.0.0.1:8000/api/getService/ for GET method.
what will be the URL if I put my files on the server in folder role.
I am trying this URL http://xx.xxx.xx.xxx/role/api/public/api/roles/ but getting the 404 error
Your files are only public accessible if they are in the public folder. Everything else, unless you set it chmod 777 (don't.) you won't be able to reach it.
My advice would be: write a function that returns your files and keep your files in your storage directory.
Otherwise, if you want to access the folder images in your public folder for example, you can access it by going to http://127.0.0.1:8000/images/
I have a strange behaviour from Laravel. I just copied the website to a new hoster. Everything is working quite fine but one thing: I can't access the images in my public folder. If I try to open an image on my own with "domain.com/img/Ausfahrten/42.png i get the following error:
error image loading
The folder structure on my server looks like this:
enter image description here
What method can't laravel find and how can I resolve this? I've already checked file permissions on the server, everything's fine there.
Laravel throw that error when it cannot find the file. Try to access to another directory without Uppercase letter in its path name.
I moved website to new server, domain stay the same, files structure stay the same, but path to public_html has beed changed. Database has been also moved.
I tried to clean cache, but i dont think I made it. This is error i get:
Could not find action file at: /home/account_name/domains/domain.co.uk/public_html/manager/controllers/default/welcome.php
account_name is different now.
I havent access to the old server, so I cant login and clear cache. I tried to do it using php script I found, but it didnt help.
Moving to new server documentation - there is welcome.php error and how to fix it, but since I haven't access to website from old server, I can't do it.
Also I can't login and clear cache in admin panel, because this message in when i wan get access to it.
I also change in db, in modx_workspaces->path from {core_path} to home/account_name/domains/domain.co.uk/publis_html/core, but didn't help.
How can i clear cache or if it's not the case, what should I do to make it work?
Update
I have change location in settings:
config.core.php
connectors/config.core.php
core/config/config.inc.php
manager/config.core.php
In .htaccess I couldn't find path to website, I didn't change anything.
I remove all content from core/cache/, except one file (.gitignore), and if I go to domain.co.uk/manager/ it's blank page, no content at all. And still can't log in.
Clear the cache on the new server manually VIA FTP or from a shell.
Change that modx_workspaces thing back
did you change all your settings in core/config/config.inc.php ?? if not do so, that is where you will set most of your paths & database credentials.
you have a backup? good!
Now upgrade to the same version of modx, that should fix all your path issues. [make sure you are not logged into the manager while trying to upgrade]
When moving the site to the new server rather watch two things:
the right paths into this files
/config.core.php
/core/config/config.inc.php
/connectors/config.core.php
/manager/config.core.php
the folder /core/cache/ is empty. They can be cleaned simply by removing the contents via ftp.
and correct the value in the database back to {core_path}