Home › Forums › Quform PHP › changing file name of single upload file before saving to server folder
This topic is: resolved
- This topic has 1 reply, 1 voice, and was last updated 5 years, 7 months ago by waubain.
Viewing 2 posts - 1 through 2 (of 2 total)
- AuthorPosts
- April 2, 2019 at 11:26 pm #28941waubainParticipant
I am using Quform to upload a pdf file to a folder on the server. All that is working, but I now need to change the name of the file prior to saving to the server folder. I am having difficulty in how to achieve this in the process.php file. I am placing the code in the Custom code section #1.
Here is my current attempt:// Custom code section #1 - see documentation for examples $temp = explode(".", $_FILES["file"]["name"]); $acronym = $form->getValue('ho_acronym'); $hotype = $form->getValue('ho_type'); $newfilename = $acronym . $hotype . '.' . end($temp); // End custom code section #1
//Process single upload field if ($file['error'] === UPLOAD_ERR_OK) { $fileData = array( 'path' => $file['tmp_name'], //'filename' => Quform_Element_File::filterFilename($file['name']), 'filename' => $newfilename, 'type' => $file['type'], 'size' => $file['size']
Am I on rhe right tract?
April 3, 2019 at 1:02 pm #28943waubainParticipantI got this working. The file name retained the .pdf without adding it back, so I was getting an additional period at the end.
- AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.