Skip to content

Commit

Permalink
Fix maxsize
Browse files Browse the repository at this point in the history
  • Loading branch information
leymannx committed Mar 28, 2017
1 parent a4a96d8 commit 7bb6513
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/Form/CSVimportForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Component\Utility\Bytes;

/**
* Implements the ajax demo form controller.
Expand All @@ -33,10 +34,23 @@ public function getFormId() {
*/
public function buildForm(array $form, FormStateInterface $form_state) {

$form['submit'] = [
$form['#attributes'] = [
'enctype' => 'multipart/form-data',
];
$form['csvfile'] = [
'#title' => t('CSV File'),
'#type' => 'file',
'#description' => ($max_size = file_upload_max_size()) ? t('Due to server restrictions, the <strong>maximum upload file size is @max_size</strong>. Files that exceed this size will be disregarded.', ['@max_size' => format_size($max_size)]) : '',
];
$form['submit'] = [
'#type' => 'submit',
'#value' => $this->t('Submit'),
'#value' => t('Commence Import'),
];
$form['#validate'] = [
'csvimport_validate_fileupload',
'csvimport_form_validate',
];
return $form;

return $form;
}
Expand Down

0 comments on commit 7bb6513

Please sign in to comment.