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.
Related
I have a codeigniter website, using the latest version of the frame work. I was hosting my website on Azure, and it was working fine - never any issues.
I've just moved all the files to a different server, a linux one - standard normal web hosting type server with cpanel.
My site loads up, however a lot of pages I use that require models, are giving off errors, as if the files do not exist
Unable to locate the model you have specified: UsersModel
Just note : I have read so many articles today, that you need to have uppercase / lowercase and all that stuff, but that's how i already have it setup, it just does not work since changing servers. and it worked perfectly fine yesterday on the Azure server.
Also, when going to the actual file in my address bar, it takes me to the 404 error. not sure if this has anything to do with it?
Did you change your base url in config file ?
All model , controllers, helper ,library name must me capital letter.
If you change server remove index.php from config file where you will get config['index']= ""; and save this.
Still you get error then save base url like domain/project_name/index.php
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 use latest version of CI, that is 2.1.2.
I upload my demo application in the following location http://www.domainname.com/myfolder/index.php
If i try to open home page, welcome controller is opened correctly. However if I try to open http://www.domainname.com/myfolder/index.php/controllername/functionname page, I get the following error message:
An Error Was Encountered
Unable to locate the model you have specified: backofficeusersmodel
In my config file, I have the following settings:
$config[‘base_url’] = ‘http://www.domainname/myfolder/’;
$config[‘index_page’] = ‘index.php’;
I also tried and
$config[‘base_url’] = ‘http://www.domainname.com/myfolder/application/’;
$config[‘index_page’] = ‘index.php’;
without any success.
However, the model is uploaded and its name is backOfficeUsersModel, not as stated in the error message all lover case.
I would like to mention that I use myModel (uploaded in application/core), and that same strange thing was happening when I upload same application under some free hosting, just there the error was that mymodel could not be located.
I upload same application on different hosting company and there it worked. Also, same application work normally on my localhost.
Anyone had similar experience?
Model files should be in application/models folder and should be named in lower case like backofficeusersmodel. Probably there is a deficiency in these requirements.