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);
    }
    
  }
  • can you provide full code of the form? – Pradeep Nayak Jun 30 at 10:19
  • @PradeepNayak I updated, please see the updated question and suggest me a solution. Thank you! – safron Jun 30 at 12:18
  • @PradeepNayak please help – safron Jun 30 at 13:00
  • Look at github.com/civicrm/civicrm-core/blob/master/CRM/Import/… and see if that helps. – Demerit Jun 30 at 16:38
  • @Demerit unfortunately It's not. is there any way i could do it?? please help, I'm beginner to CiviCRM – safron Jul 1 at 17:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.