1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

Allow a script to delete files

Discussion in 'Plesk for Windows - 8.x and Older' started by murfitUK, Nov 20, 2006.

  1. murfitUK

    murfitUK Guest

    Not sure if this is the correct place to post but I hope someone can help.

    My website is hosted on a Plesk 7.6 Windows server and I am having trouble changing permissions to allow a script to delete or rename files.

    I am building a website and a back-end admin page to allow me to upload .jpg files. The uploading part is fine - initially got an error message about not having permission to write the file but I was able to change permission by clicking a box in the control panel (although I think it was more by lucky guess than skill).

    Problem now is that I am getting error messages when trying to delete files from the sever or rename them. This is a typical error:

    Warning: rename(table.jpg,chart.jpg): Permission denied in C:\Inetpub\vhosts\murfituk.com\httpdocs\testarea\pictest\index.php on line 4

    The script in this case is a simple php file:
    rename($oldname, $newname);

    This index.php file and the jpg are in the same folder.

    The same error happens if I use unlink($file)

    I've had a look at the permissions for index.php and the folder pictest and have tried randomly clicking various options. There are lots of options to choose from and I'm getting nowhere fast.

    Can anyone offer guidance as to what I need to look at to make this work?
  2. renleon

    renleon Guest

    Hi, its the permissions of the folder that contains the images you need to worry about, not the permissions of the php script.

    Go in to File Manager and click the permissions (padlock) icon for the folder which contains the images.

    Im guessing you have already ticked Allow Read and Allow Write boxes for both Plesk IIS User and Plesk IIS WP User. If not tick them for both accounts.

    Then clicked the advanced button. You will see the same two accounts at the bottom of the list with <not inherited> beside them. Tick the boxes "Delete Subfolders and Files" and "Delete" for both accounts.

    This will allow you to delete the files.
  3. murfitUK

    murfitUK Guest

    It worked! Thank you renleon.