please someone give me a code to delete a file in a folder, ie one code to be used on a variety of file deletion

Recommended Answers

if the file is on the server-

if (file_exists("folder/myfile.xlsx"))
			unlink("folder/myfile.xlsx");
Jump to Post

if the file is on the server-

if (file_exists("folder/myfile.xlsx"))
			unlink("folder/myfile.xlsx");

Give Op Something to work on instead of straight code. That way they won't learn.
That being said, I would suggest you check

Jump to Post

All 5 Replies

if the file is on the server-

if (file_exists("folder/myfile.xlsx"))
			unlink("folder/myfile.xlsx");

if the file is on the server-

if (file_exists("folder/myfile.xlsx"))
			unlink("folder/myfile.xlsx");

Give Op Something to work on instead of straight code. That way they won't learn.
That being said, I would suggest you check SPL's directory iterator. There are couple of examples under comments

I have no problem helping others..I'm not a teacher.

brings a parse error on the unlink line

I have no problem helping others..I'm not a teacher.

doing for them is not helping them it is making them more lame and dependant on somebody

Be a part of the DaniWeb community

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