Search

Hello I'd like to change the default behavior of fileUpload filed, but I don't now if it is possible or if there is an extension to do this (I haven't found one...) Here the scenario:

I have a section called "media category" with

  • a "name" text box filed
  • a "client" select box link to "client" section

than I have a section called "media" with

  • a "name" text box filed
  • a "category" select box link to "media category" section
  • a file upload filed pointing to the "workspace/media" folder

I'd like to change the behavior of the file upload filed basing on the value of the value of "client" set in "media category" entry linked to the "media" entry I'm saving.
The best option wold be to save the file not in the default "workspace/media" folder but in the "workspace/media/{$client}/" folder
The second best option would be to save the file in the default "workspace/media" folder but prepending the {$client} value to the original file name: "{$client}-origFileName.ext"

I really don't know if it would be possible... I'll really appreciate any advice on how to do this or how to address the problem in any different way.

Thanks for the help

Daniele

Reflected file upload might let you do that.

Thanks, now I'm really close to get what I want!!!

This extension is really interesting but to transform the filename in {$client}-filename I have to have a "client" filed in the same section...

so I add an "id" reflection field in the "media category" section storing a value equivalent to "{client} -> {category name}"

Than I linked the "media category" section to the "media" section using the new "id" field

and last I ad a "try-for-upload-rename" Reflected file upload field and set it like this (not checked the "always create unique name" option):
{substring-before (entry/media-category, ' ->')} - {entry/try-for-upload-rename}

the resulting file name is like: client-fileName-uniqueToken.extension.extension
I don't undertend why the is the unique token and the double extension... Any advice?

thanks again
daniele

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details