tinnumaverick Posted October 1, 2010 Share Posted October 1, 2010 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?? Quote Link to comment https://forums.phpfreaks.com/topic/214944-how-to-delete-a-file-using-php/ Share on other sites More sharing options...
schilly Posted October 1, 2010 Share Posted October 1, 2010 What are your web server's permissions on that directory? If it can't delete the file, it likely can't chmod it either. Quote Link to comment https://forums.phpfreaks.com/topic/214944-how-to-delete-a-file-using-php/#findComment-1118134 Share on other sites More sharing options...
tinnumaverick Posted October 1, 2010 Author Share Posted October 1, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/214944-how-to-delete-a-file-using-php/#findComment-1118138 Share on other sites More sharing options...
Alex Posted October 1, 2010 Share Posted October 1, 2010 You can't access files on a user's computer through PHP. Quote Link to comment https://forums.phpfreaks.com/topic/214944-how-to-delete-a-file-using-php/#findComment-1118140 Share on other sites More sharing options...
tinnumaverick Posted October 1, 2010 Author Share Posted October 1, 2010 You can't access files on a user's computer through PHP. is there any other way so that i can delete the file?? Quote Link to comment https://forums.phpfreaks.com/topic/214944-how-to-delete-a-file-using-php/#findComment-1118142 Share on other sites More sharing options...
schilly Posted October 1, 2010 Share Posted October 1, 2010 Wait. Delete off the person's computer or off the web server? Quote Link to comment https://forums.phpfreaks.com/topic/214944-how-to-delete-a-file-using-php/#findComment-1118143 Share on other sites More sharing options...
tinnumaverick Posted October 1, 2010 Author Share Posted October 1, 2010 Wait. Delete off the person's computer or off the web server? good sense of humor... keep it up!! Quote Link to comment https://forums.phpfreaks.com/topic/214944-how-to-delete-a-file-using-php/#findComment-1118144 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.