Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check filename has extension. Make more obvious. #801

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions resources/views/docstore-customer/file/upload.foil.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,23 @@
->actionButtonsCustomClass( "grey-box")
->class('col-8')
->rules([
'name' => 'required|max:100'
'name' => ['required', 'max:100', 'match:"/^(?:^..*)\.\w{1,5}$/"']
])
?>

<?= Former::file( 'uploadedFile' )
->id( 'uploadedFile' )
->label( ( $t->file ? 'Replace' : 'Upload' ) . ' File' )
->class( 'form-control border-0 shadow-none' )
->multiple( false )
->blockHelp( $t->file ? "You only need to choose a file here if you wish to replace the existing one. Do not select a file to edit other details but leave the current file in place."
: "Select the file you wish to upload." );
?>

<?= Former::text( 'name' )
->id('name')
->label( 'Name' )
->label( 'File Name' )
->title( 'File name including extension' )
->blockHelp( "The name of the file (this is as it appears on listings in the web interface rather than on the filesystem). "
. "<b>This is also the name the downloaded file will have - so use the appropriate extension.</b>");
?>
Expand Down Expand Up @@ -55,15 +65,6 @@
->blockHelp( "The minimum privilege a user is required to have to view and download the file." );
?>

<?= Former::file( 'uploadedFile' )
->id( 'uploadedFile' )
->label( ( $t->file ? 'Replace' : 'Upload' ) . ' File' )
->class( 'form-control border-0 shadow-none' )
->multiple( false )
->blockHelp( $t->file ? "You only need to choose a file here if you wish to replace the existing one. Do not select a file to edit other details but leave the current file in place."
: "Select the file you wish to upload." );
?>

<div class="form-group">
<div class="col-lg-offset-2 col-sm-offset-2">
<div class="card mt-4">
Expand Down Expand Up @@ -128,4 +129,4 @@
});
});
</script>
<?php $this->append() ?>
<?php $this->append() ?>