Kesavan
Kesavan

Reputation:

How to upload a file to a folder without 777 permission?

I want to upload a file to a folder which has not 777 permission. How can i do this using php?

Upvotes: 2

Views: 2444

Answers (1)

dmah
dmah

Reputation: 236

You could set up the directory on the server to be either:

1) owned by the user running the web server process and allowed user write access

or

2) be a part of the group that the user running the web server process is in and allowed group write access

For example, if the you are running apache2 and it is owned by www-data in the group www-group, you would set your directory:

chown www-data directory
chmod u+w directory

or

chgrp www-group directory
chmod g+w directory

Upvotes: 5

Related Questions