2

I have the following folder-structure:

-storage 
  -app
    -orders
      -cat1
      -cat2

Within either the cat1 or the cat2 folder (depending on user input) I want to create another folder and put a xml file in there.
This is how I tried to create the directory within the cat1-folder and put the xml file in there:

$uuid = Uuid::uuid4();
$id = $uuid->toString();
$path = '/orders/cat1/'.$id;
Storage::makeDirectory($path, 0755, true, true);
Storage::put($id.'test.xml', $xml);

What happens:
The folder ($id as name) gets created in the right place:

-storage
  -app
    -orders
      -cat1
        -123456789
      -cat2

But the xml will be stored in another folder here:

-storage
  -app 
    -123456789   // xml gets stored in another
       -test.xml // folder within app-folder
    -orders
       -cat1
          -123456789 // where the xml should be placed
       -cat2

I just can seem to find a way to put the xml in the directory I've just created ._.

2 Answers 2

5

Storage::put starts from app folder.

Use this code:

Storage::put($path . '/test.xml', $xml);
Sign up to request clarification or add additional context in comments.

1 Comment

of Storage::disk('disk')->put($path . '/test.xml', $xml); if you want/defined another disk
2

You could try to store it like this:

Storage::put($path . '/test.xml', $xml);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.