1

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.

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

3
  • 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. May 31 '17 at 17:09
  • 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
    May 31 '17 at 17:15
  • 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: craftcms.stackexchange.com/questions/2113/… May 31 '17 at 17:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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