3

I have a problem in image unlink in Internet Explorer, but it works in Mozilla.

I have used php code:

<?php

unlink("./product_photos/".$name);


?>
staticbeast
  • 2,073
  • 2
  • 22
  • 24
soumya
  • 35
  • 7

1 Answers1

1

PHP is not affected by browser quirks.

If unlink() is failing, it probably has to do with your PHP. Does the file path point to a file? What does var_dump(file_exists("./product_photos/".$name)); say before deleting it? If it isn't (bool) true, there is your problem :)

Be also sure that$name is sanitized if it is from the user, otherwise I may enter ../../../your-site/index.php (a directory traversal attack).

alex
  • 479,566
  • 201
  • 878
  • 984