Jump to content
Server Maintenance This Week. ×

I am working on a script to automatically rename the file uploaded into a container field.


This topic is 958 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I have several container fields in my database and I would like to set them up so that when a file is dragged into them it automatically renames it.   Each container field will rename the file dragged into it in the accordance of the field it goes into to.  Example container field1, renames it to Field1.zip, container 2, Field2.zip, etc.....

I have the script set to go off in set script triggers under OnObjectModify.  I know the path where the file will be stored.  I just can't seem to get it to figure it out.

 

Do I need to use the "rename file" command in a script?

I am trying this and it is telling me it 

1329177624_ScreenShot2021-09-10at2_18_04PM.thumb.png.d150e557409031e19bb7890b4835e126.png

Rename File [ : "change.log" ; New name: "change1.log" ]

Link to comment
Share on other sites

Your question seems to be cut off in the middle, and it's not clear what exactly the problem is.

AFAIK, if you drag a file into a container field, the data is embedded in the container field - so there is no file that can be renamed. You may be able to export the file to a known location, rename it there and reinsert it into the container field (I haven't tested any of this).

--
Note also that having numbered fields is a symptom of poor structure*. And I believe that using invalid field names will bite you at some point.

(*) I now see that I am repeating myself:
https://fmforums.com/topic/108209-script-that-downloads-the-file-associated-with-the-button-clicked-on/?do=findComment&comment=486828&_rid=72594

 

 

Edited by comment
Link to comment
Share on other sites

This topic is 958 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.