author avatar

satya

Thu Jul 25 2024

while using form.file_field for file attachments we can restrict the file type to any type if we want.
For eg: if we want to accept file of type image then we can pass accept attribute.


 <%= form.file_field :picture, accept: "image/*" %>


Note: This will disable other file types in your local file dialog while enabling the image files only 🪄 .
#rails , #active-storage