0

I planning to save the user submitted file in the civicrm file table. I have tried these code to get the submitted file name, but it doesn't work

function postprocess(){
    $file = $this->_submitValues['uploadFile'];
    
}

Any help would be appreciated!

Update :

This is my code, i can get the title, option value except the uploaded file name.where am i going wrong ??

function buildQuickForm() {
    $this->add('text', 'title', ts('Title'),'' ,TRUE);
    $this->add('File', 'uploadFile', ts('Upload the file'),  TRUE);
    $this->add('select', 'option', ts('option'),
      array(
        '0' => ts('- select -'),
        '3' => ts('option 1'),
        '4' => ts('option 2')
      ) 
    );

    $this->addButtons(array(
      array(
        'type' => 'submit',
        'name' => ts('Submit'),
        'isDefault' => TRUE,
      ),
    ));
  }

  function postprocess(){

    foreach($this->_submitValues as $key => $values){
      civi::log()->debug($key);
      civi::log()->debug($values);
    }
    
  }
7
  • can you provide full code of the form? Commented Jun 30, 2020 at 10:19
  • @PradeepNayak I updated, please see the updated question and suggest me a solution. Thank you!
    – safron
    Commented Jun 30, 2020 at 12:18
  • @PradeepNayak please help
    – safron
    Commented Jun 30, 2020 at 13:00
  • Look at github.com/civicrm/civicrm-core/blob/master/CRM/Import/… and see if that helps.
    – Demerit
    Commented Jun 30, 2020 at 16:38
  • @Demerit unfortunately It's not. is there any way i could do it?? please help, I'm beginner to CiviCRM
    – safron
    Commented Jul 1, 2020 at 17:47

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.