Reply To: Capture file name of uploaded file

Home Forums Quform PHP Capture file name of uploaded file Reply To: Capture file name of uploaded file

#29091

waubain
Participant

I am still having a problem. The filename value in the new array of form inputs are showing a NULL for the filename. I am using the single file upload.

“filename”:null

All of the other form elements are populating the new array as expected. Does the array need to be decoded or parsed?

this is my code


        /** Custom code section #1 - see documentation for examples **/
        
            //Capture form input values
            $ho_meetdate = $form->getValue('meetingdate');
            $ho_acronym = $form->getValue('ho_acronym');
            $ho_type = $form->getValue('ho_type');
            //get uploaded file name  
            $files = $form->getValue('upload');
            $ofilename = ($files[0]['filename']);
                   
            //Rename uploaded file
            $newfilename = $ho_acronym . $ho_type; 
            //Create new array if does not exist or append if exists
            
            $arr_file = array();
                $arr_file['meetdate'] = $ho_meetdate;
                $arr_file['acronym']  = $ho_acronym;
                $arr_file['type']     = $ho_type;  
                $arr_file['ofilename']= $ofilename; 
                $arr_file['nfilename']= $newfilename;  
            //Save the JSON string to a text file.
            $ho_encoded = json_encode($arr_file);
                file_put_contents("../../editor/handout_arrayTest.txt", $ho_encoded); 
        
        /** End custom code section #1 **/

Array contents = {“meetdate”:”2019-05-02″,”acronym”:”aa”,”type”:”_ho_1c.pdf”,”ofilename”:null,”nfilename”:”aa_ho_1c.pdf”}

Thank you for your help

Be inspired. © 2019 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy