Add metadata to file after upload from frontend

I managed to let my users uploads files from my frontend. This is good.
But now I want to add a corresponding metadata file to an upload automatically. I’m not using the panel and don’t want to use it for this task.

How can I add a metadata file after a succesful upload?

(When I’m talking about the ‘metadata file’ I mean the .txt associated with each media file of a page)

Thank you :slight_smile:

You won’t be able to use hooks in this case. Maybe you can hook into your upload script, after successful file upload, you create a file in the filesystem. You can use toolkit file methods for this.

I think this is going to be difficult. Why don’t you want to use the panel? I think without it you will have to programatically generate the text file, which will get more complicated if your site is multilingual.

What kind of meta information are we talking about?

And then $file->update() to update the created file:

Shouldn’t be too complicated, I think.

Thank you :slight_smile:

While waiting for an answer, I did exactly what @texnixe just post. It works fine and it was simple. Once created, the file is easily updatable with kirby framework. (thanks @texnixe)

@jimbobrjames I’m making a website/“online tool” for my research team and most of them are unable or don’t want to learn something as simple as the Kirby panel. It’s less time consuming for me to build a custom tool than explaining something to someone who’s absolutly not interested in using a full fledged CMS. I only want my users to upload and comment some files. I want to store as a meta information for each file stuff like author name, description, file title and a discussion (comments). So far everything is good.

Thanks for your help!

I see, fair enough. Nothing stopping you from using the panel your self though, even if you don’t let your colleagues loose on it :slight_smile:

As long as you don’t have to rebuild the Panel on the frontend, I think it’s totally fine to use Kirby without it. In fact, many people still write directly into text files locally and then push to server.

It’s a very specific project for a very specific kind of user :slight_smile: . They are wise and definitely can use and learn everything they want but some of them clearly decided to put energy on other tasks. It’s fine and I understand. Technology is there for them to. I’m definitely using the panel for myself and my users can still use it if they want. I planned my frontend to have very, very limited features. Just enough to be useful and simple. It’s also not a public platform. It’s more of a team collaboration tool with only the features we need. My goal is to make it simpler (a lot!!!) than Google Drive and easy to maintain. I thought Kirby was the right choice for it.

Thanks for your interest.