Customise default upload filename

piers davidson 4 years ago updated 4 years ago 5

Is it possible to define/customise the default upload filename.

An example of this is when uploading photos from an iphone, filerun is naming the file what looks like a unique uuid (I suspect because the photo doesn't have a name?)

What would be great is if we could define a template name, i.e. "yyyy-MM-dd hh:mm:ss" that is the default upload name if none exists.


FileRun will always upload a file with its original name, as it is on the remote device that is uploading it, and it will never rename it to anything else. The HTTP protocol also does not allow for uploading files without filenames, so that is not a technically possible scenario.

One could however write a script for renaming files, after upload: http://docs.filerun.com/custom_event_scripts

Makes sense.

The custom event script will work well, do you have any documentation on what properties are available to change. What i will try to do is:

1) Check to see if the filename looks like a uuid using $data['file_name']

2) See if the extension is an image using $data['file_ext'] - Is there a way I can check if its a photo easier?

3) Change the metadata description to save the old filename - Is there a way to get the Description field

4) See if in the upload to folder the filename exists (if it does, increment the end till the name doesn't exist) - Is there a way to get all filenames in the upload to folder?

5) Rename file based on creation date - is there a way to get file creation date

I've made a bit of progress, but having trouble renaming the file as it loses its metadata.

Is there a way to get filerun to move the file (through code) instead of:


Here's my current code

Upload.php - Gist

$data = \FileRun\Files\Actions\Rename::prepare($relativePath, $newName);
if (!$data) {
$rs = \FileRun\Files\Actions\Rename::run($data);
if (!$rs) {

This should help.

Fill "$relativePath" and "$newName" appropriately. The $relativePath is a FileRun relative path, no a regular relative path. For a file in a user's home folder it looks like this "/ROOT/HOME/file.ext".

This action is a full rename user action, logged and subject to the user's permissions.

One more question, is there some way to get the file creation date if available.

I'm fine for image, using the exif data, but I can't get it for videos easily, since you have it available is there a method to retrieve it that I can use?