This topic is locked

Create Output Files and Attach to Email

5/6/2016 4:26:11 PM
PHPRunner General questions
P
PhpApprentice author

I am looking for some basic Hello World code then would like to expand from there.
First
Upon clicking on a button Event
Inside function OnServer($params, $result)
$new_file_name = date('Y-m-d');

$new_file_name = "relative_path/" . $new_file_name . ".txt";

$file_saved_on_server = fopen($new_file_name, "w");

$txt_to_write = "I love Donald Duck\n";

fwrite($file_saved_on_server, $txt_to_write);

fclose($file_saved_on_server);
So I need to know where is best practice to put this file using PhpRunner, path wise, and what works. My syntax above may not be perfect.
Second
Once I understand this, then I will.

SELECT some fields from some table like customer invoices.

Loop through and create multiple files, for example new files so I can have each customers invoices in separate files, each with unique file names.

Will basically be the same as above.
Third
I will attach the files from the server directory to send emails to different directory, likely using runner_mail.

$attachments = array();
Fourth
I wish to create pdf files instead of simple text files, and I am hoping to use some straightforward pre written and tested code, not finding it yet.
Thank you much

lefty 5/8/2016

You might want to post this in the support area. But for inspiration check fpdf.org for generating pdf on the fly. I tried this with mixed results. See this link in asp.http://www.asprunner.com/forums/topic/18655-generate-pdf-after-add-event/ I realize you are trying to this in a button but same idea.

P
PhpApprentice author 5/9/2016

Thank you. I will read up on the link.