Page 1 of 1

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

Posted: Fri May 25, 2018 10:43 am
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

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

Posted: Fri May 25, 2018 1:20 pm
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,

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

Posted: Tue May 29, 2018 9:25 am
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

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

Posted: Tue May 29, 2018 11:41 am
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,