I made a script that uses the copy() function to upload a file to a directory on the server. The script works just fine when I leave the directory unprotected. However, I have protected the directory with .htpasswd and .htaccess so that the files that are uploaded are not public domain. This makes the PHP script return an error in the browser:
Warning: Unable to create '/home/.1qaz/vault/files.url.com/vault/DSCF0025.JPG': Permission denied in /home/.1qaz/vault/files.url.com/index.php on line 11
If I understand this correctly, it means the PHP script has no authority to get around the .htaccess authentication. I would like a way to pass authentication to the directory, or get around the whole authentication process altogether.
What would you recommend?