Kirby 4 - Skip Fileupload Dialog

Hi there,
this a bit about the workflow in panel. I really like Kirby but sometimes it’s hard to adjust to changes, when you were happy with what you had. And for me this is the new File Upload Dialog.

When I’m creating a new project, my images and files usally have the right filename. So when filling in the content, the uploader just creates a ton of unneccessary clicks that I like to avoid. Also when I’m creating images for clients, I want them to keep the filename and don’t make it too easy for them to change it.

Also it lacks of a few features I’ve wished for, like the replacement of images and files. Some clients have larger downloadpages with 20+ PDF-files that updated regulary with the same filename. Replacing 20+ Files with the replace-dialog is no fun. This would be the perfect situation for the upload-dialog to ask me if I want to replace the current files or rename the new ones. Currently the only way is to replace the files by uploading them directly to the server and almost every client wants to avoid this.

I’ve made a post on Nolt when the first alpha-versions where released, but it didn’t get much response.

So sorry for the long post here, the topic was in my mind and I had to let it out.

The question, in short, is:
Is there a way to skip the upload-dialog?

Thanks in advance
Tom

2 Likes

For anybody who isn’t afraid of dirty hacks and has the same problem with the uploader, here is my solution so far. Create a panel.js, add it in your config.php and add this little snippet of javascript:

window.setTimeout(() => {
  window.panel.events.on('drop', () => {
    if(window.panel.upload){
      window.panel.upload.submit();
    }
  })
}, 500);

The timeout is needed for the panel to be fully initialised, I don’t know if there is another way to check for that. With that at least the upload-dialog is automaticly submitted when you add files with drag’n drop.

Hey, I’d also like to disable the file upload dialog. We’re uploading tons of images and I’ve created some backend functionality to automatically rename the file to something based on the page title. So this upload dialog really is just in the way and creating extra clicks.
I haven’t tried the setTimeout, but it seems like too much of a hack to me…

Here’s my hacky solution: overwrite the k-upload-dialog to immediately submit once it’s created.

panel.plugin('my-plugin/panel', {
  components: {
    'k-upload-dialog': {
      extends: 'k-upload-dialog',
      created() {
        // Submit immediately, we don't want this upload dialog...
        this.$emit('submit');
      },
    },
  },
})
1 Like

Thanks for your solution. I almost forgot about my hacky try, it worked for me so far. But your solution looks way more failsafe. So thanks for sharing.

cheers
Tom