Gravity Forms uploading additional file types

I’m using Gravity Forms on a WooCommerce site and I’m trying to allow some additional image types to be uploaded (.tif, .eps, etc.).

I’m completely confused as to why it’s not working.

Read More

If you try to upload a non-allowed file extension, you get the following error:

“The uploaded file type is not allowed. Must be one of the following: jpg, jpeg, png, gif”

I’ve search through every Gravity Form file and found two references regarding image uploads. The first in form_display.php which prints the error based on “allowedExtensions”.

$field["validation_message"] = empty($field["errorMessage"]) ? sprintf(__("The uploaded file type is not allowed. Must be one of the following: %s", "gravityforms"), strtolower($field["allowedExtensions"]) )  : $field["errorMessage"];

Next, is the allowedExtensions snippet found in js.php

field.label = "<?php _e("Post Image", "gravityforms"); ?>";
field.inputs = null;
field["allowedExtensions"] = "jpg, jpeg, png, gif";

However, changing any of those does nothing. It still prints the same error even if you delete any of them or try to add any file types.

I’m guessing it has to be pulling the allowedExtensions from somewhere else outside of Gravity Forms…

Any ideas?

Related posts

Leave a Reply

2 comments

  1. Gravity Forms doesn’t allow additional image filetypes such as EPS and TIFF to be added to the image upload form because these cannot be rendered as thumbnails without installing some sort of server-side component to convert the TIFF etc. to a format which can be displayed by a browser, i.e. JPEG, PNG or GIF.

    You’ll either have the non-trivial task of installing such a component and modifying the Gravity Forms module to handle these formats; or you could use the standard file upload form field and forgo the thumbnail display.