I want to delete a file named shiva.txt from desktop. I had tried
$filename = "filepath";
unlink($filename);
I had also tried by changing the mode of the directory to 0777. but no use still the file is not deleted.
any suggestions!!
deleting file from desktop using php
Moderator: General Moderators
-
tinnumaverick
- Forum Newbie
- Posts: 7
- Joined: Fri Oct 01, 2010 2:32 pm
- DigitalMind
- Forum Contributor
- Posts: 152
- Joined: Mon Sep 27, 2010 2:27 am
- Location: Ukraine, Kharkov
Re: deleting file from desktop using php
It's impossible. PHP is a server side scripting language
-
tinnumaverick
- Forum Newbie
- Posts: 7
- Joined: Fri Oct 01, 2010 2:32 pm
Re: deleting file from desktop using php
can i delete a file from server??
I want to delete a file from FOXML directory in this path
/srv/fedora/tomcat/webapps/formConfirm_1/WEB-INF/classes/FOXML
I had tried this code
<?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/shiva.xml";
unlink($filename);
?>
but no use...file not deleted... Is any thing else i am missing?? I am a newbie to php.
I want to delete a file from FOXML directory in this path
/srv/fedora/tomcat/webapps/formConfirm_1/WEB-INF/classes/FOXML
I had tried this code
<?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/shiva.xml";
unlink($filename);
?>
but no use...file not deleted... Is any thing else i am missing?? I am a newbie to php.
- DigitalMind
- Forum Contributor
- Posts: 152
- Joined: Mon Sep 27, 2010 2:27 am
- Location: Ukraine, Kharkov
Re: deleting file from desktop using php
Sorry, I'm drunk at the moment and it's difficult to read your code without
Code: Select all
.
One of possible solutions is:
[syntax=php]
system("rm -rf $path");
[/syntax]
make sure $path contains just path (without any ;, &&, etc)
:)-
tinnumaverick
- Forum Newbie
- Posts: 7
- Joined: Fri Oct 01, 2010 2:32 pm
Re: deleting file from desktop using php
DigitalMind wrote:Sorry, I'm drunk at the moment and it's difficult to read your code withoutCode: Select all
. One of possible solutions is: [syntax=php] system("rm -rf $path"); [/syntax] make sure $path contains just path (without any ;, &&, etc) :)[/quote] Thanks for your reply... but my acutal 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
- DigitalMind
- Forum Contributor
- Posts: 152
- Joined: Mon Sep 27, 2010 2:27 am
- Location: Ukraine, Kharkov
Re: deleting file from desktop using php
Code: Select all
unlink($filename);