TonalDev
TonalDev

Reputation: 583

Enable PHP access to folder in windows

I'm trying to give access to a php uploader to write uploaded files to folders outside of apache's scope.

The apache folder:

/cygdrive/c/apache24  (c:\apache24)

The php folder:

/cygdrive/c/php

The uploader folder:

/cygdrive/c/apache24/htdocs/uploader

Uploader directive:

define('RELATIVE_UPLOAD_DIR', '/cygdrive/c/Users/myusername');
define('UPLOAD_DIR', rtrim(dirname($_SERVER['SCRIPT_FILENAME']), '/') . '/' . RELATIVE_UPLOAD_DIR);

The uploader will upload files to the uploader's folder, but i am trying to upload files to Windows Users folder.

/cygdrive/c/Users/myusername

How can i enable the Users folder and subtree in php.ini so the uploader can write files to it?

Upvotes: 2

Views: 2087

Answers (1)

Radiotrib
Radiotrib

Reputation: 639

In a *Nix environment you would have to make the target directory writable by the apache process owner. If you don't know what that is, take a look in the httpd.conf file. Look for two lines like:

User _www Group _www

That user must have write access to any target directory. I guess it's just the same in Windows.

I must admit to not liking the idea of writing to user directories though. Might be better to have a rethink on what you are trying to do and find a way to keep userland safe and secure, whilst giving them access to the data.

Upvotes: 4

Related Questions