Reputation: 7226
I have a PHP page that writes files onto my local PC, into a specific folder named UploadedImages. This all works fine. The problem is that when I go to look at the file (always an image file -- a .png in this case), and double-click it, windows says I don't have permission to view it. Again, file permissions on the UploadedImages folder is wide open (Everyone -> Read/Write), and my login account has Full Control, and my login account is the Owner of the folder.
If I right-click the file and go into permissions, it shows that I have no permissions on the file. I can go in and grant myself ownership and permissions, then view it -- but it makes no sense that I have to do this every time.
How can I permanently solve this so that every file my PHP script writes into that folder I have automatic/full access to it?
I am running Windows 10, IIS 10.0 and PHP 5.6.11. It appears that IUSR account is getting the permissions, but why would I (the ADMIN on the folder) have all my rights revoked just because PHP writes a file there?
Upvotes: 0
Views: 234
Reputation: 468
@SweatCoder: You said:
Again, file permissions on the UploadedImages folder is wide open (Everyone -> Read/Write), and my login account has Full Control, and my login account is the Owner of the folder. [...] If I right-click the file and go into permissions, it shows that I have no permissions on the file. I can go in and grant myself ownership and permissions, then view it
This is what's called "inheritance". You need to set inheritance on the folder, so permissions on files are inherited from the parent directory.
//edit: see the icacls
help information in cmd.exe:
icacls /?
Upvotes: 0
Reputation: 155
One of solutions is try to run web server under certain user (not admin) to which you have full access rights. Second possible solution: maybe your virtual host config contains directive which force server to work under admin or user to which you dont have access - try to change it.
Upvotes: 0