File upload path change

Hi,

I created a plugin using Builder.

By default, Uploads are going to

/storage/app/uploads/public/random-dir/random-name.pdf

The CMS is giving the files a random directory and name.

But how to upload to custom-directory

/storage/app/announcements/filename.pdf

Without getting the File name changed.

Announcements.php - Model

public $attachOne = [
        'pdf' => 'System\Models\File'
    ];

fields.yaml

    pdf:
        label: 'File upload'
        mode: file
        fileTypes: 'pdf,mp3'
        useCaption: true
        thumbOptions:
            mode: crop
            extension: auto
        span: auto
        type: fileupload

Hey @dijodill

The mediafinder field is commonly used for this purpose, since it allows custom paths.