We are creating custom admin pages for administrators and part of those need to include download links for files uploaded through a front-end Gravity Form. We don’t want to expose the direct download links and would like to use the secure hashed links used in the GF entry screens. Is there a way to generate these ourselves?
Thanks very much
Hi Tom. If you look in the plugin file gravityforms/includes/fields/class-gf-field-fileupload.php you will find the function that Gravity Forms uses to generate the secure download link.
if ( strpos( $file, $upload_root ) !== false ) {
$file = str_replace( $upload_root, '', $file );
$download_url = site_url( 'index.php' );
$args = array(
'gf-download' => urlencode( $file ),
'form-id' => $this->formId,
'field-id' => $this->id,
'hash' => GFCommon::generate_download_hash( $this->formId, $this->id, $file ),
);
if ( $force_download ) {
$args['dl'] = 1;
}
$download_url = add_query_arg( $args, $download_url );
}
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.