SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Thread: deleting files

  1. #1
    SitePoint Addict
    Join Date
    Oct 2009
    Location
    London, UK
    Posts
    382
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Question deleting files

    Hi there,

    A project I'm working on at the moment requires me to delete files and folders on the server.

    I'm testing it locally at the moment, and I'm running into a couple of problems.

    Firstly, even though the subfolder and the files have their permissions set to 0777, I get the error message:
    Warning: unlink(/Users/mickyginger/Sites/galleries/Cradles/index.php) [function.unlink]: Permission denied in /Users/mickyginger/Sites/includes/helpers.inc.php on line 20
    Secondly, and more worryingly, as I'm using a mac I have a hidden file .ds_store in every folder, which is created by mac os x, which also cannot be deleted, because of permission settings.

    Can anyone shed some light on the best practice for the creation and deletion of files and folders with php.

    Many thanks,
    Mike

  2. #2
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    70 Post(s)
    Tagged
    0 Thread(s)
    this request isnt being called from /Users/mickyginger/Sites/galleries/Cradles/index.php is it? (Cant delete a file in use - which it will be if it's open in anything...)

  3. #3
    SitePoint Addict
    Join Date
    Oct 2009
    Location
    London, UK
    Posts
    382
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Nah, from /Users/mickyginger/Sites/admin/galleries/index.php ...

  4. #4
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    70 Post(s)
    Tagged
    0 Thread(s)
    can you delete other files in that directory?

  5. #5
    SitePoint Addict
    Join Date
    Oct 2009
    Location
    London, UK
    Posts
    382
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    There aren't any other files in the directory. Hmm, gimme a sec, I'll run a test with some txt file or other.

  6. #6
    SitePoint Addict
    Join Date
    Oct 2009
    Location
    London, UK
    Posts
    382
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Nah, can't delete anything. I placed a text file in the folder with permissions set to 0777, and I got the same error.

  7. #7
    SitePoint Guru aamonkey's Avatar
    Join Date
    Sep 2004
    Location
    kansas
    Posts
    953
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    there may be a directory above the one in question with lower permissions.
    aaron-fisher.com - PHP articles and more

  8. #8
    SitePoint Addict
    Join Date
    Oct 2009
    Location
    London, UK
    Posts
    382
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Yeah, but I kinda want that in place. Like, I don't want php to be able to delete important files. I thought that by setting up a subfolder with permissions set to 0777, I could put everything that I wanted php to delete in there, anything that's essential for the site would sit above it protected by lower permissions.

    Am I on the wrong lines here?


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •