Gravity Forms image upload preview

Notice: A non well formed numeric value encountered in /customers/b/b/d/puddinq.com/httpd.www/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 118Notice: A non well formed numeric value encountered in /customers/b/b/d/puddinq.com/httpd.www/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 119

Gravity forms is like magic, you can create a form with advanced options without any real knowledge of coding. The basic plugin does not offer a way to show image previews for uploaded images, but with a little extra code it is easily implemntated.

First you need an image upload field:

      We set the extensions to only allow the image type we set
      Then we set the maximum upload size to 5MB

After the upload field we place the preview field, which we can position using the HTML block. Add it to your form. We need to variables to know which field the look to so write down the form id and the field id of the upload field.

      The form id
      The field id

Now we can fill the content of our HTML block with the code we need:

The line below ‘change this’ you change the 1 to be your form id and the 12 to be you field id and that’s it