Set file upload restrictions in Zoho Creator
Hey Creators,
Welcome to the next post in the Creator Simplified series.
Today, we’ll explore how to implement file upload restrictions to limit user submissions to specific file types. By implementing an allowed list for file uploads, you can optimize the data you collect and prevent complications arising from multiple formats. This proactive approach not only enhances data integrity but also improves the overall user experience.
Use Case: Fuel Reimbursement with File Uploads
Imagine a fuel reimbursement form that allows employees to upload receipts for their fuel expenses. To maintain consistency and ensure only relevant file types are submitted, you can restrict uploads to just PDF and PNG formats.
Setting Allowed File Types:
- if(input.File_upload != "") // Check if the file upload field is not empty
- {
- allowed_list = {"pdf","png"}; // List of allowed file extensions
- // Get the file extension by splitting the filename
- splitList = input.File_upload.toList("."); // Split the uploaded file name by periods (.)
- ext = splitList.get(splitList.size() - 1).toLowerCase();
- // Get the file extension (last element of the list) and convert it to lowercase
- if(!allowed_list.contains(ext)) // Check if the extension is NOT in the allowed list
- {
- alert "This file type is not accepted."; // Show alert message
- cancel submit; // Prevent form submission
- }
- }
Demo:
In this example, when a user uploads a file, the script checks the file extension against the allowed list. If the uploaded file is not a PDF or PNG, an alert is displayed, and the form submission is cancelled. This workflow is triggered during the form submission validation, ensuring only acceptable file types are submitted. This approach helps maintain data integrity and enhances the user experience by providing clear feedback on acceptable file types.
That’s it for today! If you have any questions or your own tips to share, drop them in the comments below. Stay tuned for more insights in our Creator Simplified series!
Zoho Desk Resources
-
Desk Community Learning Series
-
-
-
-
-
-
-
-
-
Sticky Posts
Introducing Creator Simplified: An exclusive learning series to enhance your app development skills
Hey Creators! Welcome to Zoho Creator's new learning series, Creator Simplified. In this series, we'll dive into real-world business use cases and explore how to translate your requirements into solutions in your Creator application. You can also expect
ANZ In-Person Zoho User Group Meetups: Focusing on Zoho Creator & Zoho Flow (September 2024)
Hello, Zoho Community! Calling all Zoho users in Australia! We're thrilled to announce the next series of Zoho User Group (ZUG) Meetups, continuing the success of our previous sessions. These meetups are a great opportunity to learn, network, and engage
[SESSION ENDED] Ask the Experts #07| Live Q&A: Building workflows with Blueprint in Zoho Creator |
Hello, Post the release of Zoho Creator Blueprint last month, we're happy to tell you that we'll be launching a new 'Ask the Experts' session on 16th September (Thursday) this month focussing on creating blueprints in Zoho Creator. The session will be
Zoho Creator Community Webinars | October - November 2020 [Completed]
Hello everyone, I’m happy to announce that Zoho Creator is hosting a new Community Webinar Series starting this October. This series is a learning initiative aimed at our developer community, where every session will take spotlight use cases focused on
Community Learning Webinar - Zoho Creator Blueprint & other release updates | July 29, 2021
Dear developers, This June, the Creator team unveiled a slew of updates including UI enhancements to the Detail View of reports, an new capabilities in Data Import and Connections, and most important of all, the release of Blueprint in Creator. Customize
Zoho CRM Plus Resources
Zoho Books Resources
Zoho Subscriptions Resources
Zoho Projects Resources
Zoho Sprints Resources
Zoho Orchestly Resources
Zoho Creator Resources
Zoho WorkDrive Resources
Zoho Campaigns Resources
Zoho CRM Resources
Writer Get Started. Write Away!
Writer is a powerful online word processor, designed for collaborative work.