Laravel 5 Filesystem: Create a Folder in a Folder - laravel

I'm programming a Filesystem Web App with Laravel at the moment and I can create folders and upload files. Now I want that when you are in a folder that you can create a new folder in the actual folder, so a folder in a folder.
Is there a way that you can save the actual path of the folder (maybe in a hidden text field or something) so the app know where you actual are and create a folder in a folder?

Assume that you are in the folder /foo/bar in your app interface, you can reflect your current location in a URL parameter, for example.
Something like this:
http://localhost/filesystem.php?current_path=/foo/bar
or if you have the URL rewriting enabled on your server:
http://localhost/filesystem/foo/bar
Now, you just need to retrieve the current_path parameter value in your controller's method and use it as you want.
And when you click on the baz subfolder in /foo/bar, update your URL parameter: ...?current_path=/foo/bar/baz. It's that simple.

Related

Magento 2 change static content folder

Is it possible to rename static content folder? f.e from ../pub/static to /pub/statix
I saw 'base url for static view files' setting in the admin panel, but if I set it to {{secure_base_url}}/statix/ and re-deploy it, magento won't create that folder and I'll receive pages without css etc. URL will point to the statix, but there won't be that directory
Or maybe I could deploy that content to statix folder to make the urls work?
You cannot change the paths of static directories. It is an absolute path and will automatically generate every time you redeploy the site.

Is there some assistance with AJAX and PHP?

I am trying to use AJAX to return high-level calculation results. However, it appears as though the PHP file that I am pointing the AJAX call to is in the '/' root directory. Here is a snapshot of how my structure is: c:\webserver\test\webroot (this is the root directory), and then c:\webserver\test\code is where the HTML and PHP files are stored - looking to use an AJAX call to point to a PHP file in the non-root folder (which is one folder up, then one folder down). I tried a few different things, such as '../code' to move up and then over, but that doesn't work. Any suggestions?
Referencing a file location via relative paths should work - you'll just need to be sure that you are navigating FROM the correct folder TO the correct folder.
This can be a bit tricky if your javascript file is located in another folder - if memory serves you must navigate from the folder containing the javascript file, not from the folder containing the index file.
Alternately, you can use FQDM http://example.com/folder/folder/file.php to reference the file. Note that if you are on localhost, you can use a hosts file to fake-out the webserver.

How to change storage path in laravel to resources/views?

In Laravel 5.5, if I upload a file from a form, it will be stored in own storage directory.
Now I want to change it and want to upload file to this path: resources/views/layouts
I think easiest solution would be:
create directory in storage directory with unique name, like layouts or so
create symlink from /storage/layouts to /resources/views/layouts
save all files you want to /storage/layouts and they will appear in /resources/views/layouts
by creating symlink I mean linux feature (https://en.wikipedia.org/wiki/Symbolic_link#POSIX_and_Unix-like_operating_systems)

how to include or extends a language file in laravel vendor folder

I'm trying to load a language folder inside a laravel's package called permissionmanager , I know that including files directly inside vendor folder isn't the recommended way, but trying to extend it on the resources/views/vendor folder was unsuccessful.
the problem occurs when i try to upload the folder to the server using filezilla,it's not allowed. because i suppose laravel's vendor folder is protected.
so how can I load that lang file (es/permissionmanager.php) in the right way?
Use the "resources/lang" folder, not "resources/views". So it will be:
resources/lang/vendor/backpack/es/permissionmanager.php

In Laravel, what folder should I put a non-public data.json file?

I have another system that will drop in a data.json file somewhere onto my Laravel site/folder structure.
I want only Laravel to be able to be able to read the json file (i.e. a user can't see it by typing a url into a browser).
Where should this file go?
I'm currently torn between putting it in application/models folder or application/[new folder]. My webroot is set to the public folder, so you can't access the application folder via a browser.
If it is in there, I'm assuming I will be able to read it within php but not javascript (which is okay).
Just create a new folder in the app/ directory. Thats not visible to outsiders. Everything visible is in the public folder, as you said. If you create a new folder you can autoload it by setting up composer.json.

Resources