Forums

Create a dynamic name for pdf file

Adnarim 27 Jan, 2011
Hello,

I've been trying to save pdf files to the server.
At this moment it's saving the pdf, but not with the name i want it to.
I want it to use the id of the form in the name of the file.
The form is being stored, but can't figure out how to call that id number and print it in the filename.
When i use a select statement it gives an internal server error and doesn't save the edits.

Any suggestions?
GreyHead 30 Jan, 2011
Hi Adnarim ,

In the ChronoForms workflow the File Uploads are handled very early on - before the DB Connection is run so the cf_id data is not available to use.

You could add code in the OnSubmit after Email box to rename the uploaded file to include the cf_id of the new record though.

Bob
Adnarim 01 Feb, 2011
I've placed this part of code:
$MyForm =& CFChronoForm::getInstance('Offertes');
$id = $MyForm->tablerow['jos_chronoforms_Offertes']->cf_id;
$pdf->Output('offertes/Offerte-'.$id.'.pdf', 'F');
$pdffile = 'offertes/Offerte-'.$id.'.pdf';

But it seems that it's not working somehow.

If i get this to work i could get the other data from the form to put in my pdf document, i guess.
GreyHead 02 Feb, 2011
Hi Adnarim,

Please check the Run Order tab. The OnSubmit block needs to run after the Autogenerated block for this to work OK.

Bob
This topic is locked and no more replies can be posted.