1

I have a PHP app and I need to delete a client-side file. How can I achieve that?

I'm new to PHP. Hope someone can help me.

5
  • 5
    A browser being able to delete a client-side file at the control of a website, no matter what language the website uses behind the scenes, is definitely a security problem and browser bug. In short: you can't. And if you figure out some way, report it to the browser makers so they can fix it. Commented Oct 25, 2010 at 3:51
  • 6
    Have you really thought this through? Imagine if any website could simply delete files on your hard disk... Holy Security Nightmare, Batman! Commented Oct 25, 2010 at 3:52
  • 2
    Just curious, what was your requirement to do such a "heinous" act? Commented Oct 25, 2010 at 5:05
  • @zengr That made me LOL. Commented Oct 25, 2010 at 5:06
  • It's a requirement from customer. I may need to discuss with him. It seems more people are looking at this post. Do you happen to be able to help me with another question? stackoverflow.com/questions/4011727/… Commented Oct 25, 2010 at 6:09

2 Answers 2

9

You can't, browsers won't allow it, full stop.

You could if you wrote a browser/ActiveX/Java plugin that has that kind of access and got the user to install it, but please don't.

Sign up to request clarification or add additional context in comments.

3 Comments

+1, but I think that smaller paragraph should actually be bolder :)
@alex No, it actually shouldn't be there at all. You can't delete client-side files, full stop. :o)
Well, I meant the please don't part :)
2

You can't do this for obvious security reasons. PHP is server side only.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.