<p>There is a checkbox when creating/editing the field labeled "Restrict allowed file types?" Checking it will reveal file type options.</p>

<p>Source: <a href="https://craftcms.com/docs/assets-fields" rel="nofollow noreferrer">https://craftcms.com/docs/assets-fields</a></p>

CC BY-SA 3.0
2017-05-31T17:09:11.060Z
Thanks Jameal. But the file is first uploaded to the asset folder, then the asset ID is passed to the entry field. If any validation takes place when the entry is saved, I don't know, but it's a moot point because the file is already sitting on the server by then. Maybe that's my problem - that I'm doing it this way.
Clive Portman
CC BY-SA 3.0
2017-05-31T17:15:28.723Z
I see. If that's the case then I'm not sure what you can do besides implementing restrictions on the front-end. I think that in most cases as long as the file isn't executed it should be okay to sit on the server temporarily while Craft figures out if it's a valid file type. After that Craft should delete it.
Jameal G
CC BY-SA 3.0
2017-05-31T17:23:49.657Z
I think I'll switch to the normal way of doing it in the docs and see if there's some validation that way. Here's the method I'm using currently: https://craftcms.stackexchange.com/questions/2113/does-anyone-have-a-working-example-of-frontend-form-with-multiple-file-upload-d
Clive Portman
CC BY-SA 3.0
2017-05-31T17:04:25.720Z
2017-05-31T17:04:25.720Z
Jameal G
<p>Is this possible? At the point of upload, the entry field isn't checked so anything can be uploaded, which is a bit worrying.</p>

<p>Then again, if it's an Amazon S3 bucket, does it even matter? It won't be sitting on the server.</p>

<assets><frontend>
How to prevent non-image files being uploaded through frontend form?
# How to prevent non-image files being uploaded through frontend form?

(Asked by: username_0 on 2017-05-31)

Is this possible? At the point of upload, the entry field isn't checked so anything can be uploaded, which is a bit worrying.

Then again, if it's an Amazon S3 bucket, does it even matter? It won't be sitting on the server.

**Tags:** assets, frontend

---

## 1 answers

### Answer by username_1 on 2017-05-31. Score: 1

There is a checkbox when creating/editing the field labeled "Restrict allowed file types?" Checking it will reveal file type options.

Source: <https://craftcms.com/docs/assets-fields>

> **Comments:**
> **username_0**: Thanks Jameal. But the file is first uploaded to the asset folder, then the asset ID is passed to the entry field. If any validation takes place when the entry is saved, I don't know, but it's a moot point because the file is already sitting on the server by then. Maybe that's my problem - that I'm doing it this way.  
> **username_1**: I see. If that's the case then I'm not sure what you can do besides implementing restrictions on the front-end. I think that in most cases as long as the file isn't executed it should be okay to sit on the server temporarily while Craft figures out if it's a valid file type. After that Craft should delete it.  
> **username_0**: I think I'll switch to the normal way of doing it in the docs and see if there's some validation that way. Here's the method I'm using currently: https://craftcms.stackexchange.com/questions/2113/does-anyone-have-a-working-example-of-frontend-form-with-multiple-file-upload-d  

---

