I want to upload a file by Ajax (without submitting the form) than process in backend, and clear the field to allow to add another file. Is it possible with Drupal 8? Can anyone provide an example?
I tried this one but without success.
$form['input']['file'] = array( '#type' => 'managed_file', '#upload_location' => "public://$file_dir/", "#upload_validators" => array( 'my_file_validator' => array(), ), );
My questions are: 1. How to add an extra process callback (backend) ? 2. How to clear the field (Front end) ?
Thank you Thank you