Formidable Forms

Formidable Forms

  • Features
  • Pricing
  • Resources
    • Docs & Support
    • Blog
    • Community
  • Solutions
    • Web Applications
    • Calculators
    • Surveys
    • Directories
    • Payments
    • Contact forms
  • Login
  • Get Formidable Forms

frm_protect_temporary_file

Last Updated: November 5, 2021

Knowledge Base → Extend Formidable Forms → Formidable Hooks - for Developers → Entry Management → frm_protect_temporary_file
Heads up!
This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.

(Since version 5.0.12) Use this hook to remove protection for temporary files.

Formidable Forms is the best WordPress Form Builder plugin. Get it for free!

Usage

add_filter( 'frm_protect_temporary_file', '__return_false' );

Parameters

  • $protect
  • $args (array)
    • form_id
    • field_id

Examples

Unprotect temporary files for one form

Use this example to turn protection off for images on a single form.

add_filter( 'frm_protect_temporary_file', 'unprotect_temporary_files', 10, 2 );
function unprotect_temporary_files( $protect, $args ) {
	$target_form_id = 117; // change 117 to the ID of your form
	if ( $target_form_id === (int) $args['form_id'] && FrmProFileField::file_is_an_image( $args['file_id'] ) ) {
		$protect = false;
	}
	return $protect;
}

Unprotect temporary files for all forms

Use this example to turn protection off for images on all forms. It will leave all images unprotected always. This example is beneficial in cases where you want to avoid plugin conflicts to prevent metadata file conflicts.

add_filter( 'frm_protect_temporary_file', 'unprotect_temporary_files', 10, 2 );
function unprotect_temporary_files( $protect, $args ) {
if ( FrmProFileField::file_is_an_image( $args['file_id'] ) ) {
$protect = false;
}
return $protect;
}

Basic Example

(Not recommended). If logged-out users can submit entries in your form, those file uploads will be publicly available. It can be unsafe, especially if you are allowing PDF uploads.

Use this example if you have set up your uploads to go to S3 or another CDN. You can then control those uploads from your CDN settings. Note: We don't have control of access to those files.

add_filter( 'frm_protect_temporary_file', '__return_false' );
  • Usage
  • Parameters
  • Examples
    • Unprotect temporary files for one form
    • Unprotect temporary files for all forms
    • Basic Example
Categories
×

Categories

  • Installation & Getting Started
  • Account Management
  • Forms
  • Entries
  • Views
  • Styles
  • Importing & Exporting
  • Add-Ons
  • Extend Formidable Forms

Using WordPress and want to get Formidable Forms for free?

Get Formidable Forms Lite Now

You do not have permission to view this form. Maybe you need to log in?

This article may contain affiliate links. Once in a while, we earn commissions from those links. But we only recommend products we like, with or without commissions.

Take on bigger projects Right Now

Get the tools you need to revolutionize your workflow and architect a masterpiece. Build the most advanced WordPress forms and actually use the data you collect in meaningful ways.

Get the most advanced WordPress form plugin and the only form builder with integrated Views.

Get Formidable Forms Now

Resources

  • Community
  • Affiliates
  • Contact
  • Free Online Form Builder

Top Features

  • Application Builder
  • Calculator Forms
  • Surveys & Polls
  • Quiz Maker
  • Form Templates
  • Application Templates
  • Directories
  • Donation Plugin

Company

  • About Us
  • Giving Back
  • Careers
  • Newsletter
  • WP Tasty
  • Nutrifox

Copyright © 2023 Strategy11, LLC. Formidable FormsĀ® is a registered trademark Strategy11, LLC.
Privacy Policy | Terms of Service | Sitemap

Join 300,000+ using Formidable Forms to create form-focused solutions fast. Get Started See User Reviews