jeudi 29 décembre 2016

Why are my filesystem paths differing in local machine and when hosted on VPS?

I have some storage operations being done in my controllers, this is the code that works on my local machine:

Storage::copy('public/filename.pdf', 'public/sub_directory/filename_'.$var.'.pdf');
Storage::delete('public/filename.pdf');

With this code, I am successfully able to copy a file in laravel_root/storage/app/public/, then copy and rename the file to laravel_root/storage/app/public/subdirectory/, the file in public/ gets deleted after the copy operation. This works on my local machine.

When I pushed the code up to the staging server, above paths did not work and I got ERROR: No such file or directory.

I got this working by changing the paths from what worked on the local machine to :

Storage::copy('filename.pdf', 'subdirectory/filename_'.$var.'.pdf');
Storage::delete('job_card.pdf');

I had to remove out the public/from the operations.

My question is - Why does this differ in local machine and when pushed to server?

I am running on macOS on local Machine and ubuntu 16 on the staging server. I did not change any of the config files.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire