私はこのtutorialをfolowにもかかわらず、私はDrupal 8はDrupalの8:file_move()検証formularで「回復可能致命的なエラー」を生成
を「回復可能致命的なエラー」を生成Drupalのログのメッセージがあります:「回復可能致命的ではエラー:(file_moveに渡される引数1)に呼び出され、配列が与えられ、インタフェースのDrupal \ファイル\ FileInterfaceを実装する必要があります..:右の "問題」ここ
私のコード
public function validateForm(array &$form, FormStateInterface $form_state) {
$file = file_save_upload('file', array(
// Validates file is really an image.
'file_validate_is_image' => array(),
// Validate extensions.
'file_validate_extensions' => array('png gif jpg jpeg'),
));
// If the file passed validation:
if ($file) {
// Move the file into the Drupal file system.
if ($file = file_move($file, 'public://')) {
// Save the file for use in the submit handler.
$form_state['storage']['file'] = $file;
}
else {a
form_set_error('file', t("Impossible d'enregistrer correctement le fichier."));
}
}
else {
form_set_error('file', t("Aucun fichier n'a été téléchargé."));
}
}
は、これは"? これはファイルをアップロードするための基本コードです。
すべての依存関係を追加しました。その他...
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Database\Database;
use Drupal\eshpubmanager\Mutuals\ESHPubManagerMutuals;
use Drupal\eshpubmanager\Calendar\ESHPubManagerCalendar;
use Drupal\Core\Datetime\DrupalDateTime;
use Drupal\Core\Routing;
use Drupal\Core\Url;
use Drupal\file\FileInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\File\FileSystemInterface;
use Drupal\Core\State\StateInterface;
use Drupal\file\Entity\File;
use Drupal\stream_wrapper_example\StreamWrapper\SessionWrapper;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\RequestStack;
誰かがアイデアを持っていますか?
ありがとうございます。やってみます。 – Croc