Need to rename multiple files that a user is uploading so names are unique on IFS

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
mhc_001
New User
Posts: 3
Joined: Fri May 25, 2018 10:32 am
First Name: Steve
Last Name: Bayne
Company Name: MHC
Contact:

Need to rename multiple files that a user is uploading so names are unique on IFS

Post by mhc_001 »

Profound UI Visual Designer - How do I add a timestamp to multiple filenames that a user is uploading?

IMG_test.JPG
IMG_test_20180522145021.JPG

I have to find a way to ensure multiple files that a user is uploading result in unique file names on IFS
User avatar
Megan
Profound Logic Staff Member
Posts: 90
Joined: Mon Sep 11, 2017 12:15 pm
First Name: Megan
Last Name: Bond
Company Name: Profound Logic
Phone: 5623227473
State / Province: California
Zip / Postal Code: 92692
Country: United States
Contact:

Re: Need to rename multiple files that a user is uploading so names are unique on IFS

Post by Megan »

Hello Steve,

We also sent you an email with this information. We are providing it here as well for others that may be interested in the answer.

This can be achieved by using the Upload Response property of the File Upload Widget and some RPG. This property will provide your RPG program with a data structure that contains the number of files (UPLOADINFO.NumFiles), the destination directory (UPLOADINFO.Directory), and a list of the file names (UPLOADINFO.Files). You can read more about this property here: http://www.profoundlogic.com/docs/pages ... d=16449718.

Using the information provided by the Upload Response, you can use the rename() function to loop through the UPLOADINFO.Files list and append the timestamp or other name extension to each of the names. You can learn more about the rename() function here: https://www.ibm.com/support/knowledgece ... namefs.htm.

Please note, this will not handle multiple files having the same name being uploaded at the same time. In order to prevent overwriting files during the upload process, you may want to set the Overwrite Files property to false. When this property is set to false, it will prevent the upload from occurring at all. If you would like to be able to handle this situation as well, please let us know so that we may research a solution for you or create a Feature Request ticket for this feature to be added to the product.

I hope this helps! If you have any questions or concerns regarding this issue, please refer to the issue in your emails or simply reply to this email while leaving the subject line intact.

Thanks,
~MEGAN BOND
Technical Support Specialist
support@profoundlogic.com
mhc_001
New User
Posts: 3
Joined: Fri May 25, 2018 10:32 am
First Name: Steve
Last Name: Bayne
Company Name: MHC
Contact:

Re: Need to rename multiple files that a user is uploading so names are unique on IFS

Post by mhc_001 »

Will this handle multiple files having DIFFERENT names being uploaded at the same time

For example, when trying to upload these 3 files at once...
IMG_0001.JPG
IMG_0002.JPG
IMG_0003.JPG

Can Profound rename each of the 3 files being uploaded automatically...
IMG_0001_20180522145021.JPG
IMG_0002_20180522145021.JPG
IMG_0003_20180522145021.JPG
User avatar
Megan
Profound Logic Staff Member
Posts: 90
Joined: Mon Sep 11, 2017 12:15 pm
First Name: Megan
Last Name: Bond
Company Name: Profound Logic
Phone: 5623227473
State / Province: California
Zip / Postal Code: 92692
Country: United States
Contact:

Re: Need to rename multiple files that a user is uploading so names are unique on IFS

Post by Megan »

Hello Steve,

Yes. This solution will work as long as each of the uploaded files has a unique name and does not conflict with an already existing file on the IFS. If multiple files are uploaded with the same name, or if there is a file on the system that already exists with the same name, you run the risk of overwriting the files. To prevent this, you would want to set the overwrite files property to false.

I hope this helps!

Thanks,
~MEGAN BOND
Technical Support Specialist
support@profoundlogic.com
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests