Jump to content

deleting files


simun

Recommended Posts

i cant find out why i cant delete files from my server, here is my script, please take a look

 

<div id="content">
    <div>
        <h1>Dokumenti</h1>
        </div>
        <div style="padding:10px;">
<?php
$myUpload = new ruverUpload();
$myUpload->uploadFile();
?>

<?

      $dir = new DirectoryIterator( "../../static/dokumenti/" . $_GET['id']  ) ;
      foreach($dir as $file )
      {
        if(!$file->isDot() && !$file->isDir() && preg_match("/.pdf$/",$file->getFilename())) {
?>
	<a href="<? echo "http://rivieradekor.hr/static/dokumenti/" . $_GET['id'] . "/" . $file->getFilename();?>"><? echo $file->getFilename();?></a>
        <? echo '<input type="button" value="Delete" onClick="'.unlink($file->getFilename()).'">' ?>
        <br>
<?
        }
      }
?>
</div>
</div>

Link to comment
https://forums.phpfreaks.com/topic/160461-deleting-files/
Share on other sites

PHP is a server side language -- once the data has been sent from the server to the user, it can do no more. If you want to have a button to delete a file, you need to make another request to the server. If you want to do this without the entire page reloading, you can do so with AJAX. I suggest you look for some beginner tutorials on that.

Link to comment
https://forums.phpfreaks.com/topic/160461-deleting-files/#findComment-846768
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.