Delete File from Server if exists


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. #complete serverpath must be given like
  2. #example "/apache/htdocs/myfile.pdf" ( not "http:xyz.com/myfile.pdf" )
  3. $DelFilePath = $setup["serverWebrootPath"] . $fileName;
  4.  
  5. # delete file if exists
  6. if (file_exists($DelFilePath)) { unlink ($DelFilePath); }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.