We are using Cognito forms for our scholarship entries. Students are required to upload their resume, essay and transcripts at the time they apply. Sometimes they try to upload their resume as their resume and their essay - for example. I know we can require they upload something - can we require the name of the upload be different?
1 Answer
I believe the scenario you're describing is possible using some simple calculations. For this example, I'm going to assume that you have three File Upload fields on your form: Resume, Essay, and Transcripts. Additionally, each File Upload field should be limited to one file per field (you can set this limit in the field settings.)
In order to prevent students from uploading two files with the same name:
- Add three Calculation fields to your form - one for each File Upload field. Label each field accordingly ("Resume Name", "Essay Name", etc.). Lastly, make sure to set each Calculation field to internal view only.
For each Calculation field, use an expression to target the name of the uploaded file ("resume.docx") in the corresponding field using the Select function. For example, the calculation for the Resume Name field should look like this:
=Resume.Select(Name)
For each File Upload field, select Show Custom Error - When, and set an error to display when the uploaded file name matches either of the file names uploaded in the other two fields. You can do this by targeting the Calculation fields you just created; for example, the custom error expression for the Essay field will look like this:
=(EssayName = ResumeName) or (EssayName = TranscriptsName)
Lastly, make sure to include a custom error message for each File Upload field ("Duplicate file name").