How to write outside the htdocs directory?


I understand that I must upload all the files of my site in the htdocs directory and that I can’t upload any file in its parent folder.

But this htdocs directory is public, so any file in it can been accessed by everybody.

So, for security reasons, I’d like to be able to upload files outside of this folder. Is it possible ?


Hi there!

Not really, you can change the permissions by right-clicking the file and clicking CHMOD
After that, you can change the permissions as shown below:

Just make sure you don’t lock yourself (owner) out! :smile:


You can’t but you can do the above way ^^^ stated by @Technical.Legendz

1 Like

Also, This isn’t file storage, you can’t store files outside .htdocs, You can only write to htdocs because that is where websites go.

For (different) security reasons, websites are only allowed to access files in their own htdocs folder. That way, if your website would ever get hacked, any malicious code cannot infect other websites on the same account.

If you want to restrict access to certain files so they cannot be accessed by browsers, the best way is to do so is with .htaccess rules. If there is a folder in your account which should not be accessible, simply create a file in that folder with the name .htaccess and the contents deny from all, and nobody will be able to access the files from the web.

I would NOT recommend tinkering with CHMOD/file permissions. It’s very tricky to restrict web access that way, and if you do it wrong, you’ll lock yourself out too.


Thank you all for your answers.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.