Improper images types being uploaded.

edited April 2011 in Modules
I've got a site where members can upload images. The problem is that the members are trying to upload .bmp and .tif images.

The images are not successfully uploaded, however, the image info (file name, location) is being saved to the database. This causes a broken image to be displayed on the front-end.

Where, in the model, should I be checking the file type and how should I kick back an error? I have already tried adding 'accept' => 'jpg|jpeg|gif|png' to the upload field which did not work.

Comments

  • edited 1:27PM
    I just posted an update that will add an unsupported error message when someone tries to upload a filetype that is not supported by the particular asset folder type. The "accept" parameter is used on the front end to limit a users ability to select filetypes but the FUEL configuration parameter $config['editable_asset_filetypes'] ultimately determines if it gets uploaded to the folder or not.
  • edited 1:27PM
    Data was still being saved to the db. Managed to crudely check the file extension in the on_before_save() method.
Sign In or Register to comment.