Is there any way that uploaded files (specifically photos) have an uploaded number?

1 being the oldest, 2 being the newest.

1 Answer 1


I'm a developer with Cognito Forms.

This is something that can be done with a series of calculations. You would also have to know how many files your end user is looking to upload, or to put a limit on how many so they don't go over the number that you set up.

We have built out a demo for the first two files that can be uploaded to your form. You can use them as an example to built up to the number that you would like to allow for your user to upload.

The way that we have set up the calculations the extra numbers will not display unless they have a file for that number. You will also want to make all the extra calculation fields 'hidden' or 'internal' so that your end users do not see them on the form, as this could confuse them.

You will want to start off with a Calculation field that I labeled 'List of files without numbers' this will be a simple calculation that will target the File Upload field and list out the file names as a comma separated list. The calculation that I used targets a File Upload field labeled 'File Upload field' just to be simple.


The next field that I added is another Calculation field, this will be where we start to number each of the uploaded files starting with the first uploaded or the 'oldest'. I labeled this Calculation field '1' so that I know this will be the calculation for the first uploaded file. You will want to note that we are not starting the count with '1' but rather starting it with '0'.

=if(string.IsNullOrEmpty(FileUploadField)) then "" else "1." + ListOfFilesWithoutNumbers.Split(',')[0]

The next field will also be a Calculation field and will be using the same calculation for the most part except that we will be looking for the second uploaded file, and labeling it as '2' even though at the end we are searching for '1'.

=if(ListOfFilesWithoutNumbers.Split(',').Count() <= 1) then "" else "2." + ListOfFilesWithoutNumbers.Split(',')[1]

The last Calculation field that you will want to set up is a calculation that will string together all the numbered file names that have been uploaded. This will be targeting the previous calculations by using their label that will start with an underscore (_) because they start with a number.

=_1+" " + _2

I have also included a link to a demo form that shows all the calculations in action and working together. You can test it and see what the build page looks like with all the elements working.


  • Hi @Nicholas Gasque that's an excellent solution, however, I've tried the demo and something happens: when you upload two items, only one image is added to the list, and after that, it doesn't add anymore, can you check it?
    – EumirAMC
    Aug 16, 2017 at 20:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.