top of page

Only Allow PDF's to be Uploaded in a Knack App

If you want only certain file types (say a PDF and not a Word document) to be uploaded to your Knack database app, you can do that. This can be done using Knack validation rules. It's pretty simple and can be very useful. Here I take you through how to accomplish that.

Interested in my Knack database services? ... Book a call with me here:

If you are a fan of building great apps with Knack, please click the Subscribe button to join my channel, and ring the bell to receive notices on all my new instructional videos. Thanks!

Full Transcript

hey folks Dave Parish here and neck Builder is doing another functionality video for you folks if you like these please uh subscribe to the channel and and like the video leavany comments if you have questions today's topic only allow PDFs to be uploaded now actually this Topic's a little broader you can allow any type of file there's a lot of use cases I'll get into those in a minute but I'm going to focus around a PDF this is accomplished using something that has called validation rules which is set upon the data side on the field itself butI'll be back in just a minute and take you through it this will be short thanks okay here's the deal on allowing only certain types of files to be uploaded to your system using validation rules this will be quick here I put together this is a knack template thing but for an example here's what use case well you might want to do it here's this could be anything but let's say you have some Services you provide and you want to have a detailed description of what they do and you have that in the form of a PDF that someone can download and put in their files or something if you have a PDFright within the app and you click on it it's just sample PDF it's going to render for you which is a good thing you can read it right within the app now I put this other field in here same thing but if it was a Word document here's what happens if it doesn't render this file type is not preview-able so then the user's got to download it grab it open it it's a pain in the ass so we don't need that let me show you how to do this first of all I'm going to remove this one so we can use it as an example go to the Builder's side make this a little bigger it's the wrong way okay here's this file or this field down here now I have a validation I'm going to take it out this is right here so you go when you go to your field this thing called validations in this game we're going to click it we're going to say hey we want to validate this what field there's one we want to be a PDF and we want to say it has file types and this validation is a whole no big topic there's all kinds of things you can do on here if it's a really big file you can prevent it from being uploaded with this but we want to say if it's anything if it's not in this case PDF PDF you don't need the dot I don't believe then you have to give a message must be a PDF okay it's as simple as that okay let's go back to our app refresh it so it so it does what it so it engages the world we just put in there let's click on this and I'm gonnaI'll try I'm gonna go grabWord document it's right here Word document I'm going to try to put it in here you can either click on this or one of those the plus here since it's a Word document it's not accepting it they can't submit it now I'm going to grab a sample PDF one do the same thing put it where it is hey it accepts it we can submit it there it is that other use cases let's say someone's submitting a budget and then an Excel format and you want to be able to edit it so you want to be able to grab it download it and do what you're gonna do with it with some users if you have a lot of them made to say oh I'm going to submit this as a PDF well you can only the same validation rule you can it must be a or if it's anything but an Excel file it won't accept it that's the deal I may do another video on validation rules there's lots of stuff you can do with it it's a great feature but I appreciate the time today thanks folks

9 views0 comments


bottom of page