simun Posted June 1, 2009 Share Posted June 1, 2009 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 More sharing options...
GingerRobot Posted June 1, 2009 Share Posted June 1, 2009 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 More sharing options...
simun Posted June 1, 2009 Author Share Posted June 1, 2009 i dont need ajax, i onley need to belete a file with reload of page, but i cacnt make i work, can you give me a sugstion what to do, thanks Link to comment https://forums.phpfreaks.com/topic/160461-deleting-files/#findComment-846816 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.