Current location: Hot Scripts Forums » Programming Languages » PHP » deleting file


deleting file

Reply
  #1 (permalink)  
Old 07-24-04, 07:41 AM
jasperma jasperma is offline
Newbie Coder
 
Join Date: Jun 2003
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts
deleting file

http://www.jumpstartpunk.com/test/Ch...202/delete.php

why wont it allow me to delete the file? (the permission is set to 777)
this is my code of delete.php:

PHP Code:

<?php

unlink
("$DOCUMENT_ROOT/test/Chapter 2/orders/orders.txt");
?>
Reply With Quote
  #2 (permalink)  
Old 07-24-04, 08:04 AM
ermau's Avatar
ermau ermau is offline
Wannabe Coder
 
Join Date: Aug 2003
Location: Florida, USA
Posts: 240
Thanks: 0
Thanked 0 Times in 0 Posts
Do you get any type of error message?

Try using $_SERVER['DOCUMENT_ROOT'] instead of $DOCUMENT_ROOT, so:
PHP Code:

<?php

unliking
($_SERVER['DOCUMENT_ROOT'].'/test/Chapter 2/orders/orders.txt');
?>
__________________
PHP / mySQL Developer
Reply With Quote
  #3 (permalink)  
Old 07-24-04, 08:17 AM
jasperma jasperma is offline
Newbie Coder
 
Join Date: Jun 2003
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts
i get this error:

Warning: unlink(/home/jumpstar/public_html/test/Chapter 2/orders/orders.txt): Permission denied in /home/jumpstar/public_html/test/Chapter 2/delete.php on line 2


and your code doesn't work either.
Reply With Quote
  #4 (permalink)  
Old 07-24-04, 08:51 AM
mikaelf mikaelf is offline
Wannabe Coder
 
Join Date: Jun 2004
Location: php[dot]net
Posts: 198
Thanks: 0
Thanked 0 Times in 0 Posts
the error occurs because your host runs safe mode PHP. although the permission is set to 777, you cannot delete the file because the file owner uid is different with the script executor uid.
Reply With Quote
  #5 (permalink)  
Old 07-24-04, 09:25 AM
jasperma jasperma is offline
Newbie Coder
 
Join Date: Jun 2003
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by mikaelf
the error occurs because your host runs safe mode PHP. although the permission is set to 777, you cannot delete the file because the file owner uid is different with the script executor uid.
ok, thanks!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Server open file altafingar ASP.NET 1 10-20-04 12:12 AM
file upload csmaster2005 PHP 1 06-16-04 06:57 PM
Getting the created file (fopen/fwrite) Programme PHP 5 02-14-04 03:09 PM
Please I Need help before all my hair is gone! LisatheNovice Perl 6 11-22-03 03:05 PM
Upload file type and size limiter! Arctic ASP 1 08-02-03 07:06 PM


All times are GMT -5. The time now is 04:14 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.