Mobile app version of vmapp.org
Login or Join
Michele947

: File Access Permission I need to upload a file to site with PHP code. How to set permission for upload folder if I want to users cant access to file by URL but PHP code read this file

@Michele947

Posted in: #Php #Security #Uploading

I need to upload a file to site with PHP code. How to set permission for upload folder if I want to users cant access to file by URL but PHP code read this file ?

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Michele947

3 Comments

Sorted by latest first Latest Oldest Best

 

@Bethany197

If possible best way to do that is to put your uploaded files outside of your webroot. That way the files won't be accessible by url but your scripts can still access them.

10% popularity Vote Up Vote Down


 

@Rivera981

Try chmod 750 on the directory, which will give you full access, the server/program read + execute access, and users no access.

10% popularity Vote Up Vote Down


 

@Sue5673885

The www (or whatever account is used to run your web server) account needs to have write access to the directory. I would assume that you could block direct access to said directory through an .htaccess file placed in that directory.

It might look something like:

Order deny,allow
Deny from all

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme