Plugin Upload path

Hi! I’m following this document on how to upload files to the panel in a custom field. But I don’t understand how can I get a url to the current page in the panel instead of using a absolute path to a dir.
Below the example code. Thanks in advance!

export default {
  methods: {
    upload() {
        url: window.panel.api + "/pages/projects+project-a/files"

Maybe this.path or something like that?

Nop. And I tried outputing this to the console but I can’t find something that looks like an URL.

I also tried Uploads | Kirby that copies the file in a hook. But I also don’t know how to get an url there :man_facepalming:

Maybe just simple JS?


But just in case I asked the team…

this.$route.params.path will get you the path of the current view.


Thanks a lot! And how about when using a route? How can i get the url in php?

The field has a model method ($this->model()) which refers to the current page object. The page object has a panelUrl method. So you should be able to use $this->model()->panelUrl()

1 Like