Anyone can tell my why it keeps saving at My Documents?

$newfile = 'temp.xls';

$wkb->SaveAs($newfile);

If I echo $newfile, it will display 'http://localhost/test/excel/temps.xls'

Its suppose to save it at same level right? wrong, it keeps saving at "My Documents"

How is that possible?

Thanks

have you try $newfile = 'C:/youre dir/temp.xls';

have you try $newfile = 'C:/youre dir/temp.xls';

Won't that move the file to the client's computer?

//how about?
$wkb->SaveAs($_SERVER['DOCUMENT_ROOT'],$newfile);
//how about?
$wkb->SaveAs($_SERVER['DOCUMENT_ROOT'],$newfile);

I have tried:

//how about?
$wkb->SaveAs($_SERVER['DOCUMENT_ROOT'].$newfile);

Is it the same thing?

This is what I am trying to do.

1. User uploads an excel file(to TMP)
2. Get the file from TMP
3. Open the file as Excel
4. Fill the excel using data from mySQL
5. Save file to root directory(PROBLEM)
6. Create Download link

This is what I did as an alternative, ugly but it does the job.

1. Save excel file to "C:/"
2. Move file to root directory using Copy() and Unlink()
3. Create download link

Somewhere I would delete any processed excel file except the current file that is to be downloaded. This is to prevent Copy() from piling up too many files.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.