is it possible to write file metadata to a file? M...
# lucee
s
is it possible to write file metadata to a file? My plan is to rename a file but keep the original file name in the metadata of the file.
j
what kind of file are we talking and what type of storage?
d
Some file types, such as media files, have a metadata embedded in their format, so it really depends on what kind of file you're talking about. However, you're better off tracking this in your system. For example, in our application we generate filenames that we use on disk from a UUID and then just track the original file name in our database. That allows us to show the original filename to users and even push the file back to the user with the original filename, but we make sure that on disk the filename won't conflict with any file system limitations and will not conflict with other file resources being uploaded.
s
ok, that was my original thought, but i was unsure if that was the preferred way
j
the reason i asked about storage type is that something like s3 has extra metadata that you can add per object that is separate from the object, itself. not that this is always (or even often) the right solution, but it's another tool in the toolbox. obviously it's not at all portable to do it that way, which is why switzerizing™ it into a db is probably the least weird/fragile way to do it.
s
hey @jamiejackson sorry i missed your response, for now it would be local file system. Soon followed up by s3, I just haven’t had the time to figure out the smoothest transition for most of my sites to move existing data to s3 and update all of the original links to that data