This topic is locked
[SOLVED]

 export function save csv file to a specific folder

12/7/2012 10:50:22 AM
PHPRunner General questions
C
chrispa author

hi,
i see export csv function .
is it possibly to after clicking export button to save the csv file to specific folder ?
i see that topic
http://www.asprunner.com/forums/topic/17015-script-to-rename-export-csv-file/pagefromsearch1
but i think i need something else to configure it
thanks

admin 12/7/2012

You need to write the code that prepares the export file and saves it to some folder on the web server. The article you mentioned provides some pointers.
Besides that you need to make sure that web server user has WRITE permissions on this folder.

C
chrispa author 12/8/2012



You need to write the code that prepares the export file and saves it to some folder on the web server. The article you mentioned provides some pointers.
Besides that you need to make sure that web server user has WRITE permissions on this folder.


thanks
can oyu give more info and links to look and inspire of thanks again

admin 12/8/2012
C
chrispa author 12/10/2012



You can find some sample code at http://code.stephenmorley.org/php/creating-downloadable-csv-files/


help please
i see that in export_functions.php
function ExportExcelSave($filename,$format,$objPHPExcel)

{

global $cCharset;

$filename = PHPExcel_Shared_String::ConvertEncoding($filename, 'UTF-8', $cCharset);

if($format == "Excel2007")

header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');

else

header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="'.now().'";');

header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $format);

$objWriter->save('php://output');

}
i think i have to change
$objWriter->save('php://output');

to save excel files to my public folder "test"
can you help ?

admin 12/10/2012

If you want to modify PHPExcel code check PHPExcel documentation at http://phpexcel.codeplex.com/releases/view/96183