• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • Support for BIND DNS has been removed from Plesk for Windows due to security and maintenance risks.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS.

Allow a script to delete files

M

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:
<?php
$oldname="table.jpg";
$newname="chart.jpg";
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?
 
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.
 
Back
Top