Welcome to W3Courses
 Like Us on Facebook

Delete File

Delete File or an Image from the Server using PHP

If you want to delete a file or an image from the server via an interface from you website, you can use the following code

<?php

function deletemyfile($filename)
{

 $filearray = explode("/", $filename);

 $filecountno = count($filearray);
 $filecountno = $filecountno-1;
 for($i=0;$i<=$filecountno;$i++)
 {
  $myfilename = $filearray[$i];
 }

Share