Hi,
I am saving my excel file in my local directory.

$objWriter->save("C:/test.xls");

How can i delete(only test.xls) this same excel file from my local directory using php. Please try to solve my problem. Thanks in advance.

Recommended Answers

All 3 Replies

You can use this function:

unlink(test.xls);

I am not sure whether it will work fine with xls file but it's worth giving a try.

Member Avatar for diafol

Should be able to regardless of the type of file.

You can use this function:

unlink(test.xls);

I am not sure whether it will work fine with xls file but it's worth giving a try.

You are right because Deleting a file is done using the PHP unlink command. At one time or accession you will wish to erase some file from your web server and you will need to use the unlink command to do it.

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.