It's possible to reload the panel page content where I'm when a file is uploaded?

Hi everyone,

I have a structure that each entry shows a preview of an image (see the next image)
27

Well, my problem appears when I upload a file with the same name that structure entry image. I want when the file is uploaded my structure (If it isn’t possible, the page) reload to see the new file in the entry. I think I can do this with a hook but I don’t know how can I reload the form.

Someone has any idea? Thanks :slight_smile:

Try

kirby()->hook('panel.file.upload', function($file) {
  panel()->redirect($file->page());
});

Or panel.file.replace or both, depending on whether you upload or replace the image.

But this may not have the desired result, because I think the image is cached in the browser and will not show up before you clear the cache.

Yes I think the problem is the cache. I tried that code and the problem continues… I 'll try to clear the cache. When I have something new I will comment. Thanks anyway :slight_smile:

You could try and add something like ?v=1.x(where x is the current timestamp or something like that) to your preview image url. Downside is that it will never be cached but for this use case it might be useful.