How to send notification without attachments if files are too big

Hello!

I’m working on a form that takes in multiple file uploads, but when the file size gets too big my email host refuses to send the notification out. Is there anyway to send the notification on its own without any attachments if the uploaded files combined exceed a certain size?

Hey Ethan,

One idea would be to use this snippet to create a zip of all the uploaded files. Now, even with the large files zipped, they’ll still probably be too big for your server but… this snippet provides a nifty merge tag {zip_url} that you could use to provide a download link to the zipped files instead of attaching them to the notification.

You’ll see the configuration at the bottom.

new GW_Zip_Files(
	array(
		'form_id'       => 123,
		'zip_name'      => 'my-sweet-archive',
		'notifications' => array( '5f4668ec2afbb' ),
	),
);

Just update form_id to your desired form’s ID, give the generated zip file a name via the zip_name paramter, and either remove the notifications parameter altogether to apply this to all notifications or get the notification ID from the URL on your notification edit view and include it per the example.

3 Likes

Where would you input this code into the form? or into the php of the plugin?

That is PHP which will go into your theme functions.php file, or you can use a plugin like this one for the snippet:

Do not modify the plugin files, and that code does not go into your form. Thank you.

Additional information:

© 2008 - 2019. Gravity Forms is a project by Rocketgenius Inc.