Docs & Support

Learn about all the Formidable features and get support from our amazing customer success team.

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.

Usage

add_filter( 'frm_protect_temporary_file', '__return_false' );

Formidable Forms makes advanced site building simple. Launch forms, directories, dashboards, and custom WordPress apps faster than ever before.

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' );
Was this article helpful? *

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.

In this article

    We have a small, but amazing team of dedicated people who are committed to helping you achieve your goals and project requirements.


    Copyright © 2025 Strategy11, LLC. Formidable Forms® is a registered trademark Strategy11, LLC.

    Join 400,000+ using Formidable Forms to create form-focused solutions fast. Get Formidable Forms