Hello,
I'm using PHP 5.0.3 and Windows 2003 Server.
I'm opening an excel spreadsheet through PHP using COM, and then saving it as a tab delimited text file.
It works the first time, I upload the file to the server, and initiate COM, open the workbook and save it as a (tab) txt file.
The problem is, I can't seem to delete the files after without a reboot of the server. This poses a problem if the user tries to reupload the same file again, as the script times out and/or crashes.
I'm sure it's a permission problem, but I don't know COM very well so any help is appreciated.
here's my code
$excel = new COM("Excel.application") or die ("excelreader: constructor");
$workbook = $excel ->application->Workbooks->Open($path);
$newFile = substr($path, 0, -3) .'txt'; //strip extension and add a text one
$wkb->SaveAs($newFile, -4158); //I don't know that -4158 is the right parameter, it may be the problem (ie, read only), but it's the only one I could find that would save the file as a tab delimited text file
//these calls don't work, the system hangs when it tries to close the workbook or quit the excel app
$wkb->Close("False");
$excel ->Quit();
Thanks for you help