.mp3 files are not generated in media folder

Hello :slight_smile:

I have a Kirby 3 installation running on Apache server and can successfully upload an .mp3 file via the panel.

My issue is that once I have uploaded my .mp3 file via the panel and I go to my frontend I get an error that the .mp3 file can not be found in the media folder.

After I refresh the page the file is there though. I have looked in the media folder and can confirm upon saving my post in the panel for all other media files (images) one is generated in the media folder but not for the .mp3 file until after visiting the page, and therefor only shows after reloading page once more.

Any ideas how to make Kirby generate also the .mp3 file to the media folder?

Much thanks for any tips

The file should actually get created as soon as the URL is called in the browser. Unless the browser loads the file from cache.

Thank you for your quick reply!

I see, for the images though as soon as I save the post in the panel I can see a .jobs folder in the media folder being created for that specific post. Not the case for the mp3 file.

The problem is that when I want to get some metadata info on the mp3 file via getId3 as that can’t find the file in the /media folder. As I’m fetching the mediaUrl() and passing that to getId3.

The easiest solution would be to point it to the content folder right?

The jobs folder for images is created because the Panel itself creates thumbs for the images for use in lists etc., while that doesn’t happen for other types of files.

Urls to the content folder won’t work out of the box, because direct access to the content folder is blocked by .htaccess (at least on Apache). You can either work with the path to the file in the content folder or force creating of the copy in the media folder via a hook, or open up the URL to the content folder (and then prevent the copy).

1 Like

Thank you, I’ll dive into hooks that sounds like a good solution! Again, many thanks

Hey, maybe this can help you. I use file create hooks for getting id3 data in my podcaster plugin: kirby-podcaster/hooks.php at master · mauricerenck/kirby-podcaster · GitHub

I think that should work for you, too.

1 Like

Amazing, that’s perfect thank you! This would indeed work well as I can get the data prior to someone visiting the page. Many thanks, great solution.