This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Stranger Pings
Stranger Pings

I have a plugin with attachMany relationship that attaches a file

public $attachMany = [
    'documents' => ['System\Models\File', 'order' => 'sort_order', 'delete' => true]
    ];

As a test it uploads to this directory...

/storage/app/uploads/public/591/1bd/553/5911bd55335df576423432.pdf

I can set to public or protected. When I set to protected I can only see through the backend. Public I can see but I want to restrict them. In the backend I can see there is only those directories.

How can I extend the file modal so I can save to

 /storage/app/uploads/mycustomfolder/591/1bd/553/5911bd55335df576423432.pdf

and still keep the file functionality? i.e still save to system_files table and use $file->path etc

Also in my plugins routes.php. I can never seem to override an image url that is stored. Is there a way of overriding the image?

Last updated

alxy
alxy

To answer one of you questions: The upload path is configurable.

Stranger Pings
Stranger Pings

Thanks for the reply,

The issue with changing the upload path is that would affect every upload. The thing I am trying to do is create a new directory other than public or protected from a plugin. The reason is that I am trying to create a folder that is accessible only by user roles.

I could just create a directory inside my plugin directory but I want to use the system_files table. But I am not sure about the logic or best way to do this.

Last updated

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.