Jump to content

how to delete a file using php


tinnumaverick

Recommended Posts

i want to delete a file from FOXML directory. I had tried this code but no use...

 

<?php

$path="/srv/fedora/tomcat/webapps/formConfirm_1/WEB-INF/classes/FOXML";

$dh = opendir($path);

while ($temp = readdir($dh)) {

if ($temp!='.' && $temp!='..' && $temp!='.htaccess') chmod($temp,777); }

 

 

$filename = "/srv/fedora/tomcat/webapps/formConfirm_1/WEB-INF/classes/FOXML/myfile.xml";

unlink($filename);

?>

 

any suggestions??

Link to comment
https://forums.phpfreaks.com/topic/214944-how-to-delete-a-file-using-php/
Share on other sites

What are your web server's permissions on that directory?

 

If it can't delete the file, it likely can't chmod it either.

 

I logged in as admin into the webserver. My actual problem is

 

I have an html form which has a delete button. whenever any user clicks the delete button, the file should be deleted from this location.

 

/srv/fedora/tomcat/webapps/formConfirm_1/WEB-INF/classes/FOXML/$filename

 

please suggest me any solutions... i am new to programming

 

 

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.