Using direct file paths for uploaded media in GravityView
When displaying File Upload fields in your Views, GravityView can either use Gravity Forms' secure download URLs or point directly to uploaded files. This article explains how to enable direct file paths and when to use this setting.
What is the direct file path option?
The Use Direct File Path for Media setting allows GravityView to bypass Gravity Forms' secure download URLs and link directly to your uploaded media files. This option appears in the field settings for File Upload fields when configuring your View.
When enabled:
- PDFs and embeddable media files (images, videos, audio) display using their direct URL
- Files load faster and Views render more quickly
- Download links are publicly accessible
- Non-embeddable files (documents like .docx, .xlsx) continue using secure paths
When to use direct file paths
Consider enabling this option when:
- Performance is a priority and you need faster View loading times
- You're displaying public media that doesn't require access restrictions
- Your files don't contain sensitive or confidential information
- You're experiencing slow load times with many media files in your View
Avoid using direct file paths when:
- Your uploaded files contain private or sensitive data
- You need to restrict file access to specific users or roles
- Security is more important than performance for your use case
How to enable direct file paths
- Navigate to your View in GravityKit > All Views.
- Click Edit to open the View editor.
- In the View editor, add or edit a File Upload field.
- Click the gear icon to open the field settings.
- Select the Use Direct File Path for Media checkbox.
- Click Update to save the View.
Note: This setting must be configured for each File Upload field individually. It doesn't apply globally to all File Upload fields in your View.
Understanding the security implications
With secure URLs (default)
When using Gravity Forms' default secure URLs:
- Files are accessed through a special download handler (
?gf-download
) - Gravity Forms validates permissions before serving the file
- Direct file URLs remain hidden from users
- Downloads can be tracked and logged
With direct file paths
When you enable direct file paths:
- Files are accessed via their actual storage URL (e.g.,
/wp-content/uploads/gravity_forms/...
- Anyone with the link can access the file
- Search engines may index these files
- File access bypasses Gravity Forms' permission checks
Warning: Only enable direct file paths for files that are intended to be publicly accessible. Never use this setting for confidential documents, private user data, or sensitive business information.
Performance benefits
Using direct file paths provides several performance improvements:
- Faster page load: Views load more quickly as the browser can fetch media files directly
- Reduced server load: Your server doesn't need to process each file request through PHP
- Better caching: Browsers and CDNs can cache media files more effectively
- Improved user experience: Images and videos display faster for your visitors
The performance improvement is most noticeable when:
- Displaying many images in a gallery-style View
- Working with large media files
- Using a CDN to serve static files
- Running on shared hosting with limited resources
Frequently asked questions
Will PDFs use direct file paths?
Yes, PDFs will use direct file paths when this setting is enabled. However, other document types like Word documents or Excel files will continue using secure URLs.
Does this affect file upload security in Gravity Forms?
No, this setting only affects how files are displayed in GravityView. It doesn't change how Gravity Forms handles file uploads or stores files.