I need to send via email an excell file after its creation, but un fortunately php don't have the rights to write in server, so I need to send it without save the file. And via browser it's not posible because you'll need to wait the creation of the excell and the database retrieving is very slow, so I wonder if there is a way to send it directly vía email. I've beeing googling for a while and haven't found a solution, thanks a lot!
edit to add code:
<?php
/** Include path **/
ini_set('include_path', ini_get('include_path').';../Classes/');
/** PHPExcel */
include (dirname(__FILE__)."/../../lib/PHPExcel.php");
/** PHPExcel_Writer_Excel2007 */
include (dirname(__FILE__)."/../../lib/PHPExcel/Writer/Excel2007.php");
/** Php Mailer */
require (dirname(__FILE__).'/../PHPMailer/class.phpmailer.php');
require '../mysqlvars.php';
require '../lib/db.php';
require '../lib/form_functions.php';
require 'includes/session.php';
require("classes.php");
$dbConn = connectDB($dbHost, $dbUser, $dbPass, $dbDB);
if (!$dbConn) {
die ('Cannot connect to database');
}
require 'includes/session.php';
require '../init.php';
require '../licence.php';
require("classes.php");
// Create new PHPExcel object
echo date('H:i:s') . " Create new PHPExcel object\n";
$objPHPExcel = new PHPExcel();
// Set properties
echo date('H:i:s') . " Set properties\n";
$objPHPExcel->getProperties()->setCreator("Maarten Balliauw");
$objPHPExcel->getProperties()->setLastModifiedBy("Maarten Balliauw");
$objPHPExcel->getProperties()->setTitle("Office 2007 XLSX Test Document");
$objPHPExcel->getProperties()->setSubject("Office 2007 XLSX Test Document");
$objPHPExcel->getProperties()->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.");
// Add some data
echo date('H:i:s') . " Add some data\n";
$objPHPExcel->setActiveSheetIndex(0);
$objPHPExcel->getActiveSheet()->SetCellValue('A1', 'Hello');
$objPHPExcel->getActiveSheet()->SetCellValue('B2', 'world!');
$objPHPExcel->getActiveSheet()->SetCellValue('C1', 'Hello');
$objPHPExcel->getActiveSheet()->SetCellValue('D2', 'world!');
// Rename sheet
echo date('H:i:s') . " Rename sheet\n";
$objPHPExcel->getActiveSheet()->setTitle('Simple');
// Save Excel 2007 file
echo date('H:i:s') . " Write to Excel2007 format\n";
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save();
print_r('ok');die; //never prints nothing
?>