I would like my clients to go to the file screen after uploading a file in the panel. This is because in my blueprint I have defined all images to have a caption, and I don’t want them to miss the place to set the caption.
But keep in mind that it’s possible to upload multiple files at once. I’m not sure if the hook is fired after each upload or after all files are uploaded. This should be tested.
Thanks @flokosiol! Good to know. Would the hook on panel.file.upload be run once per file, in the case of multiple files, or do you think it returns an array of files? In that case I think I could check if it’s an array and in that case don’t redirect…
Hey, thanks @texnixe — I just tried it but it didn’t work, is there something I need to do to ‘refresh’ the settings like restarting kirby in some way to clear a cache? I uploaded a file with that but it doesn’t seem to actually intercept the upload in any way :S (sorry if that is a stupid question)
Since the uploads are handled via AJAX you are only redirecting the response to the AJAX call. You can preview the response on the Network tab on Chrome’s Developer Tools.