change filename on file upload

  • Are there any hooks or filters in the Perch forms app to rename a file during upload? I'd like to rename a pdf file during upload to value of a text field type. In this case, a surname text field value would be added at beginning of filename and any spaces in file name would be replaced with a hyphen.

  • Hi Scott,


    The Perch Forms app fires the event perch_forms.received when a response is received:


    PHP
    1. $API = new PerchAPI(1.0, 'your_app_id');
    2. $API->on('perch_forms.received', function(PerchSystemEvent $Event){
    3. $formID = $Event->subject['_id'];
    4. $fields = $Event->subject['fields'];
    5. $files = $Event->subject['files'];
    6. });