Skip to content

Commit

Permalink
UI option for limiting upload size in new file fields and the html5 f…
Browse files Browse the repository at this point in the history
…ile field
  • Loading branch information
Josh Pollock committed Nov 21, 2018
1 parent 9e8eaae commit ef5f3e6
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 4 deletions.
33 changes: 31 additions & 2 deletions fields/cf2_file/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,37 @@
<div class="caldera-config-group">
<label for="{{_id}}_allowed"><?php echo esc_html__('Allowed Types', 'caldera-forms'); ?></label>
<div class="caldera-config-field">
<input id="{{_id}}_allowed" type="text" class="field-config" name="{{_name}}[allowed]" value="{{allowed}}">
<p class="description"><?php echo esc_html__('Comma separated eg. jpg,pdf,txt', 'caldera-forms'); ?></p>
<input
id="{{_id}}_allowed"
type="text"
class="field-config"
name="{{_name}}[allowed]"
value="{{allowed}}"
aria-describedby="{{_id}}_allowed-desc"
>
<p class="description" id="{{_id}}_allowed-desc">
<?php echo esc_html__('Comma separated eg. jpg,pdf,txt', 'caldera-forms'); ?>
</p>
</div>
</div>

<div class="caldera-config-group">
<label for="{{_id}}_max_upload"><?php echo esc_html__('Max Upload Size', 'caldera-forms'); ?></label>
<div class="caldera-config-field">
<input
id="{{_id}}_max_upload"
type="number"
min="0"
step="8"
class="field-config"
name="{{_name}}[max_upload]"
value="{{max_upload}}"
aria-describedby="{{_id}}_max_upload-desc"

>
<p class="description" id="{{_id}}_max_upload-desc" >
<?php echo esc_html__('Max file size in bytes. If 0, any file size is allowed.', 'caldera-forms'); ?>
</p>
</div>
</div>

Expand Down
31 changes: 29 additions & 2 deletions fields/file/config_template.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,41 @@
<?php esc_html_e('Allowed Types', 'caldera-forms'); ?>
</label>
<div class="caldera-config-field">
<input id="{{_id}}_allowed" type="text" class="field-config" name="{{_name}}[allowed]" value="{{allowed}}">
<p class="description">
<input
id="{{_id}}_allowed"
type="text" class="field-config"
name="{{_name}}[allowed]"
value="{{allowed}}"
aria-describedby="{{_id}}_allowed-desc"
>
<p class="description" id="{{_id}}_allowed-desc">
<?php esc_html_e('Comma separated eg. jpg,pdf,txt', 'caldera-forms'); ?>
</p>
</div>
</div>


<div class="caldera-config-group">
<label for="{{_id}}_max_upload"><?php echo esc_html__('Max Upload Size', 'caldera-forms'); ?></label>
<div class="caldera-config-field">
<input
id="{{_id}}_max_upload"
type="number"
min="0"
step="8"
class="field-config"
name="{{_name}}[max_upload]"
value="{{max_upload}}"
aria-describedby="{{_id}}_max_upload-desc"

>
<p class="description" id="{{_id}}_max_upload-desc" >
<?php echo esc_html__('Max file size in bytes. If 0, any file size is allowed.', 'caldera-forms'); ?>
</p>
</div>
</div>


{{#script}}
jQuery(function($){

Expand Down

1 comment on commit ef5f3e6

@Shelob9
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For #1399

Please sign in to comment.