I'm using PHPExcel to generate an excel file and I need to save it on a specific server folder by calling my PHP file with ajax (to avoid the extra window open).
I've found this post and the second answer have something close to what I need, but that downloads the file through the browser and I don't want that. I just want to save the .xls file in a specific folder of the server, not in my computer.
This is what I have:
PHP:
$objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);
$objWriter->save('../pdf-totext/'.$_POST["folder"].'/'.$_POST["filename"]); //save the file here
JS:
$.ajax({
type:'POST',
url:'php/libs/PHPExcel-1.8/F29.php',
data: {folder:folder,filename:filename}
});
So it's possible to save a PHPExcel generated .xls file, calling my PHP file through AJAX?
EDIT
I'm ok with the server and client side thing, it's just I want to call my PHP file through ajax, so my PHP file saves the .xls on a server folder.
EDIT 2
It works if I move to another window like this (and with GET instead POST in the PHP file):
window.open('php/libs/PHPExcel-1.8/F29.php?folder='+folder+'&filename='+filename,'_blank');
But if It doesn't work if I call the PHP file through AJAX.